ZFS pool names can contain spaces.

-- 
Richard
=== modified file 'util/getroot.c'
--- util/getroot.c	2011-12-23 18:25:24 +0000
+++ util/getroot.c	2012-01-25 05:28:52 +0000
@@ -357,7 +357,7 @@
     char cksum[257], notes[257];
     unsigned int dummy;
 
-    cmd = xasprintf ("zpool status %s", poolname);
+    cmd = xasprintf ("zpool status \"%s\"", poolname);
     fp = popen (cmd, "r");
     free (cmd);
 
@@ -382,7 +382,10 @@
 		st++;
 	      break;
 	    case 1:
-	      if (!strcmp (name, poolname))
+	      /* Use strncmp() because poolname can technically have trailing
+	       * spaces, which the sscanf() above will not catch.  Since we've
+	       * asked about this pool specifically, this should be safe. */
+	      if (!strncmp (name, poolname, strlen(name)))
 		st++;
 	      break;
 	    case 2:

Attachment: signature.asc
Description: This is a digitally signed message part

_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel

Reply via email to