aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKarel Zak <kzak@redhat.com>2016-10-25 12:32:23 +0200
committerKarel Zak <kzak@redhat.com>2016-10-25 12:32:23 +0200
commitf37f50594f5be9454c4cc24f1a9541b06afd52b6 (patch)
tree6c9722dbedc2e38b9f12e9534b1456881f4ed7fa
parent81d26db3e1e1d1e1375fb158d5f37a794ffe11bb (diff)
downloadutil-linux-f37f50594f5be9454c4cc24f1a9541b06afd52b6.tar.gz
libfdisk: fix script Type= and Id= parsing
The parser is not consistent and *case insensitive* Type= and Id= tokens are not expected on all places. Addresses: https://github.com/karelzak/util-linux/issues/367 Signed-off-by: Karel Zak <kzak@redhat.com>
-rw-r--r--libfdisk/src/script.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/libfdisk/src/script.c b/libfdisk/src/script.c
index 0d89fdaf15..4c1f9c7b96 100644
--- a/libfdisk/src/script.c
+++ b/libfdisk/src/script.c
@@ -904,11 +904,10 @@ static int parse_line_nameval(struct fdisk_script *dp, char *s)
rc = next_string(&p, &pa->name);
} else if (!strncasecmp(p, "type=", 5) ||
-
!strncasecmp(p, "Id=", 3)) { /* backward compatibility */
char *type;
- p += (*p == 'I' ? 3 : 5); /* "Id=" or "type=" */
+ p += ((*p == 'I' || *p == 'i') ? 3 : 5); /* "Id=", "type=" */
rc = next_string(&p, &type);
if (rc)