* [PATCH] Spaces in ZFS Pool Names
@ 2012-01-25 5:33 Richard Laager
0 siblings, 0 replies; only message in thread
From: Richard Laager @ 2012-01-25 5:33 UTC (permalink / raw)
To: The development of GNU GRUB
[-- Attachment #1.1: Type: text/plain, Size: 52 bytes --]
ZFS pool names can contain spaces.
--
Richard
[-- Attachment #1.2: grub-zfs-poolname-spaces.patch --]
[-- Type: text/x-patch, Size: 791 bytes --]
=== 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 #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 198 bytes --]
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2012-01-25 5:33 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-01-25 5:33 [PATCH] Spaces in ZFS Pool Names Richard Laager
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.