Add braces around and indent the `zpool status` parsing loop The switch is one statement, so this doesn't change the actual effect of the code, but it makes it more clear. Also, if someone were to try to add a debugging printf() after the if statement, it would work correctly. ;) Index: grub/util/getroot.c =================================================================== --- grub.orig/util/getroot.c 2012-01-31 00:50:24.000000000 -0600 +++ grub/util/getroot.c 2012-01-31 00:51:15.352398000 -0600 @@ -274,36 +274,38 @@ if (sscanf (line, " %s %256s %256s %256s %256s %256s", name, state, readlen, writelen, cksum, notes) >= 5) - switch (st) - { - case 0: - if (!strcmp (name, "NAME") - && !strcmp (state, "STATE") - && !strcmp (readlen, "READ") - && !strcmp (writelen, "WRITE") - && !strcmp (cksum, "CKSUM")) - st++; - break; - case 1: - if (!strcmp (name, poolname)) - st++; - break; - case 2: - if (strcmp (name, "mirror") && !sscanf (name, "mirror-%u", &dummy) - && !sscanf (name, "raidz%u", &dummy) - && !strcmp (state, "ONLINE")) - { - if (ndevices >= devices_allocated) - { - devices_allocated = 2 * (devices_allocated + 8); - devices = xrealloc (devices, sizeof (devices[0]) - * devices_allocated); - } - devices[ndevices++] = xasprintf ("/dev/%s", name); - } - break; - } - + { + switch (st) + { + case 0: + if (!strcmp (name, "NAME") + && !strcmp (state, "STATE") + && !strcmp (readlen, "READ") + && !strcmp (writelen, "WRITE") + && !strcmp (cksum, "CKSUM")) + st++; + break; + case 1: + if (!strcmp (name, poolname)) + st++; + break; + case 2: + if (strcmp (name, "mirror") && !sscanf (name, "mirror-%u", &dummy) + && !sscanf (name, "raidz%u", &dummy) + && !strcmp (state, "ONLINE")) + { + if (ndevices >= devices_allocated) + { + devices_allocated = 2 * (devices_allocated + 8); + devices = xrealloc (devices, sizeof (devices[0]) + * devices_allocated); + } + devices[ndevices++] = xasprintf ("/dev/%s", name); + } + break; + } + } + free (line); }