diff options
author | Karel Zak | 2017-02-17 14:47:00 +0100 |
---|---|---|
committer | Karel Zak | 2017-02-17 14:47:00 +0100 |
commit | 21f1206aac9a291e587c50037fc2b490d0f4c72d (patch) | |
tree | 5422665426d470d020562d4718f7c327b8351a4e /libfdisk | |
parent | libfdisk: verify partno from template (diff) | |
download | kernel-qcow2-util-linux-21f1206aac9a291e587c50037fc2b490d0f4c72d.tar.gz kernel-qcow2-util-linux-21f1206aac9a291e587c50037fc2b490d0f4c72d.tar.xz kernel-qcow2-util-linux-21f1206aac9a291e587c50037fc2b490d0f4c72d.zip |
libfdisk: (gpt) make sure it's GPT in public API
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'libfdisk')
-rw-r--r-- | libfdisk/src/gpt.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/libfdisk/src/gpt.c b/libfdisk/src/gpt.c index b6158fb45..6962e7702 100644 --- a/libfdisk/src/gpt.c +++ b/libfdisk/src/gpt.c @@ -2530,7 +2530,9 @@ int fdisk_gpt_set_npartitions(struct fdisk_context *cxt, uint32_t entries) assert(cxt); assert(cxt->label); - assert(fdisk_is_label(cxt, GPT)); + + if (!fdisk_is_label(cxt, GPT)) + return -EINVAL; gpt = self_label(cxt); @@ -2652,7 +2654,9 @@ int fdisk_gpt_get_partition_attrs( assert(cxt); assert(cxt->label); - assert(fdisk_is_label(cxt, GPT)); + + if (!fdisk_is_label(cxt, GPT)) + return -EINVAL; gpt = self_label(cxt); @@ -2682,7 +2686,9 @@ int fdisk_gpt_set_partition_attrs( assert(cxt); assert(cxt->label); - assert(fdisk_is_label(cxt, GPT)); + + if (!fdisk_is_label(cxt, GPT)) + return -EINVAL; DBG(LABEL, ul_debug("GPT entry attributes change requested partno=%zu", partnum)); gpt = self_label(cxt); |