From df91e6790082e250c1c04a4d8ca2154be7329f62 Mon Sep 17 00:00:00 2001 From: Felix Zielcke Date: Sun, 6 Dec 2009 10:20:01 +0100 Subject: [PATCH] 2009-12-06 Felix Zielcke * util/misc.c (make_system_path_relative_to_its_root): Correctly cope with mount points. --- ChangeLog | 5 +++++ util/misc.c | 12 +++++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) 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. */ -- 2.39.5