From: Felix Zielcke Date: Sun, 6 Dec 2009 09:20:01 +0000 (+0100) Subject: 2009-12-06 Felix Zielcke X-Git-Tag: 1.98~332 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=df91e6790082e250c1c04a4d8ca2154be7329f62;p=thirdparty%2Fgrub.git 2009-12-06 Felix Zielcke * util/misc.c (make_system_path_relative_to_its_root): Correctly cope with mount points. --- diff --git a/ChangeLog b/ChangeLog index 77b2165ab..53667833e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2009-12-06 Felix Zielcke + + * util/misc.c (make_system_path_relative_to_its_root): Correctly cope with + mount points. + 2009-12-05 Carles Pina i Estany * gettext/gettext.c: Include `'. Define grub_gettext_msg, diff --git a/util/misc.c b/util/misc.c index 626851306..d46051efe 100644 --- a/util/misc.c +++ b/util/misc.c @@ -500,7 +500,17 @@ make_system_path_relative_to_its_root (const char *path) /* buf is another filesystem; we found it. */ if (st.st_dev != num) - break; + { + /* offset == 0 means path given is the mount point. */ + if (offset == 0) + { + free (buf); + free (buf2); + return strdup ("/"); + } + else + break; + } offset = p - buf; /* offset == 1 means root directory. */