All of lore.kernel.org
 help / color / mirror / Atom feed
From: Felix Zielcke <fzielcke@z-51.de>
To: The development of GRUB 2 <grub-devel@gnu.org>
Subject: Re: [PATCH] Re: grub-install --root-directory=/mnt /dev/sda1 fails
Date: Fri, 12 Jun 2009 01:25:44 +0200	[thread overview]
Message-ID: <1244762744.3552.65.camel@fz.local> (raw)
In-Reply-To: <1244762505.3552.64.camel@fz.local>

Am Freitag, den 12.06.2009, 01:21 +0200 schrieb Felix Zielcke:
> Am Donnerstag, den 11.06.2009, 01:00 +0200 schrieb Felix Zielcke:
> > Am Dienstag, den 09.06.2009, 23:51 +0200 schrieb Vladimir 'phcoder'
> > Serbinenko:
> > 
> > > +
> > > +char *grub_make_system_path_relative_to_its_root (char *path)
> > > +{
> > > +
> > > +  struct stat st;
> > > +  char buf[500], buf2[500];
> > > Use malloc instead of static allocation
> > 
> > Changed.
> > 
> > > +      p = strrchr (buf, '/');
> > > +      if (p != buf)
> > > +	*p = 0;
> > > +      else *++p = 0;
> > > You assume path starts with /. You have to check this. Otherwise you
> > > may get sigsegv
> > 
> > Changed.
> > > +      strcpy(buf2,buf);
> > > Just save (p - buf) instead of copying buf to buf2
> > 
> > I did this now if realpath () isn't avaible.
> > Now realpath is used in case it's avaible. POSIX specifies it and
> > readlink is actually using it if it's avaible. I didn't read the source
> > correctly.
> > The problem is just Cygwin. It has it but it returns the cygwin path.
> > So C:\\Windows would get /cygdrive/c/windows, which is easy to handle.
> > But realpath ("/boot/grub") would return /boot/grub which isn't true
> > from Windows/GRUB point of view.
> > Maybe Christian and Bean can say something about it.
> > MingW doestn't have it and I don't know what Windows would have, so the
> > MingW users would still use my own way.
> 
> Here's now a new one which aborts if realpath is avaible but doestn't
> support (path, NULL)
> and the fallback function is changed to dynamically allocate the memory.
> And now all memory is properly free'd

args just noticed I forgot the *free_ptr = buf2;
I'm too lazy now to send an extra patch just for this.
-- 
Felix Zielcke




  reply	other threads:[~2009-06-11 23:25 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-05-06 14:31 grub-install --root-directory=/mnt /dev/sda1 fails Felix Zielcke
2009-05-06 15:12 ` Vladimir 'phcoder' Serbinenko
2009-06-01 19:39   ` Felix Zielcke
2009-06-08 21:20     ` [PATCH] " Felix Zielcke
2009-06-09 21:51       ` Vladimir 'phcoder' Serbinenko
2009-06-10 23:00         ` Felix Zielcke
2009-06-11 23:21           ` Felix Zielcke
2009-06-11 23:25             ` Felix Zielcke [this message]
2009-06-12 10:28               ` Felix Zielcke
2009-06-12 16:21                 ` Pavel Roskin
2009-06-12 16:33                   ` Felix Zielcke
2009-07-01 14:33     ` Felix Zielcke
2009-07-04 20:09       ` Robert Millan
2009-07-08 14:16         ` Felix Zielcke

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1244762744.3552.65.camel@fz.local \
    --to=fzielcke@z-51.de \
    --cc=grub-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.