All of lore.kernel.org
 help / color / mirror / Atom feed
From: Richard Laager <rlaager@wiktel.com>
To: The development of GNU GRUB <grub-devel@gnu.org>
Subject: [PATCH] Spaces in ZFS Pool Names
Date: Tue, 24 Jan 2012 23:33:28 -0600	[thread overview]
Message-ID: <1327469608.3844.10.camel@watermelon.coderich.net> (raw)


[-- 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 --]

                 reply	other threads:[~2012-01-25  5:33 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1327469608.3844.10.camel@watermelon.coderich.net \
    --to=rlaager@wiktel.com \
    --cc=grub-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.