]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
* util/getroot.c (grub_find_root_devices_from_mountinfo): Handle btrfs
authorVladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Fri, 22 Jun 2012 20:11:23 +0000 (22:11 +0200)
committerVladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Fri, 22 Jun 2012 20:11:23 +0000 (22:11 +0200)
subvolumes.

ChangeLog
util/getroot.c

index c12da1a0c8b7ecde33410dd8efaf045545c312c7..e2d5e0f0c8b8771154f95bacd35879e1c6d46151 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2012-06-22  Vladimir Serbinenko  <phcoder@gmail.com>
+
+       * util/getroot.c (grub_find_root_devices_from_mountinfo): Handle btrfs
+       subvolumes.
+
 2012-06-22  Vladimir Serbinenko  <phcoder@gmail.com>
 
        Implement flow control for http.
index cbcd3aa5fa8310a1b5c73bb39ad468cf747365dd..e103fb6c114aebf42e9067f54d50965459f64050 100644 (file)
@@ -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)
        {