[Top][All Lists]
[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 12:28:23 +0200 |
Am Freitag, den 12.06.2009, 01:25 +0200 schrieb Felix Zielcke:
> 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.
Ok here's a new one which compiles without warnings.
--
Felix Zielcke
make_sys_path_relative.patch.6
Description: Text document
- Re: grub-install --root-directory=/mnt /dev/sda1 fails, Felix Zielcke, 2009/06/01
- [PATCH] Re: grub-install --root-directory=/mnt /dev/sda1 fails, Felix Zielcke, 2009/06/08
- Re: [PATCH] Re: grub-install --root-directory=/mnt /dev/sda1 fails, Vladimir 'phcoder' Serbinenko, 2009/06/09
- Re: [PATCH] Re: grub-install --root-directory=/mnt /dev/sda1 fails, Felix Zielcke, 2009/06/10
- Re: [PATCH] Re: grub-install --root-directory=/mnt /dev/sda1 fails, Felix Zielcke, 2009/06/11
- Re: [PATCH] Re: grub-install --root-directory=/mnt /dev/sda1 fails, Felix Zielcke, 2009/06/11
- Re: [PATCH] Re: grub-install --root-directory=/mnt /dev/sda1 fails,
Felix Zielcke <=
- Re: [PATCH] Re: grub-install --root-directory=/mnt /dev/sda1 fails, Pavel Roskin, 2009/06/12
- Re: [PATCH] Re: grub-install --root-directory=/mnt /dev/sda1 fails, Felix Zielcke, 2009/06/12