diff --git a/ChangeLog b/ChangeLog index c12da1a0c..e2d5e0f0c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2012-06-22 Vladimir Serbinenko + + * util/getroot.c (grub_find_root_devices_from_mountinfo): Handle btrfs + subvolumes. + 2012-06-22 Vladimir Serbinenko Implement flow control for http. diff --git a/util/getroot.c b/util/getroot.c index cbcd3aa5f..e103fb6c1 100644 --- a/util/getroot.c +++ b/util/getroot.c @@ -651,7 +651,21 @@ grub_find_root_devices_from_mountinfo (const char *dir, char **relroot) { ret = grub_find_root_devices_from_btrfs (dir); if (relroot) - *relroot = strdup (entries[i].enc_root); + { + char *ptr; + *relroot = xmalloc (strlen (entries[i].enc_root) + + 2 + strlen (dir)); + ptr = stpcpy (*relroot, entries[i].enc_root); + if (strlen (dir) > strlen (entries[i].enc_path)) + { + while (ptr > *relroot && *(ptr - 1) == '/') + ptr--; + if (dir[strlen (entries[i].enc_path)] != '/') + *ptr++ = '/'; + ptr = stpcpy (ptr, dir + strlen (entries[i].enc_path)); + } + *ptr = 0; + } } if (!ret) {