grub-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] Re: grub-install --root-directory=/mnt /dev/sda1 fails


From: Felix Zielcke
Subject: Re: [PATCH] Re: grub-install --root-directory=/mnt /dev/sda1 fails
Date: Fri, 12 Jun 2009 01:21:45 +0200

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
-- 
Felix Zielcke

Attachment: make_sys_path_relative.patch.5
Description: Text document


reply via email to

[Prev in Thread] Current Thread [Next in Thread]