diff options
author | Karel Zak | 2019-01-10 12:17:19 +0100 |
---|---|---|
committer | Karel Zak | 2019-01-10 12:17:19 +0100 |
commit | e6effcac61152880451da25142cf93931834ffa9 (patch) | |
tree | bb0ee9aaaefeeb2a4d24b09be32d49d1915e71f8 /libfdisk | |
parent | fdisk: support CTRL+C on change-partition-type dialog (diff) | |
download | kernel-qcow2-util-linux-e6effcac61152880451da25142cf93931834ffa9.tar.gz kernel-qcow2-util-linux-e6effcac61152880451da25142cf93931834ffa9.tar.xz kernel-qcow2-util-linux-e6effcac61152880451da25142cf93931834ffa9.zip |
fdisk: make partition types uses more robust
* report failed partition type parsing
* make sure partition types code (from user reply) for MBR is hex
Reported-by: Jonny Grant <jg@jguk.org>
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'libfdisk')
-rw-r--r-- | libfdisk/src/parttype.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/libfdisk/src/parttype.c b/libfdisk/src/parttype.c index 5b4be6c3a..110ef3ba7 100644 --- a/libfdisk/src/parttype.c +++ b/libfdisk/src/parttype.c @@ -313,9 +313,11 @@ struct fdisk_parttype *fdisk_label_parse_parttype( str, lb->name)); types = lb->parttypes; - if (types[0].typestr == NULL && isxdigit(*str)) { + if (types[0].typestr == NULL) { unsigned int code = 0; + DBG(LABEL, ul_debugobj(lb, " parsing hex")); + errno = 0; code = strtol(str, &end, 16); @@ -331,6 +333,8 @@ struct fdisk_parttype *fdisk_label_parse_parttype( } else { int i; + DBG(LABEL, ul_debugobj(lb, " parsing string")); + /* maybe specified by type string (e.g. UUID) */ ret = fdisk_label_get_parttype_from_string(lb, str); if (ret) |