]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
libfdisk: (gpt) make sure it's GPT in public API
authorKarel Zak <kzak@redhat.com>
Fri, 17 Feb 2017 13:47:00 +0000 (14:47 +0100)
committerKarel Zak <kzak@redhat.com>
Fri, 17 Feb 2017 13:47:00 +0000 (14:47 +0100)
Signed-off-by: Karel Zak <kzak@redhat.com>
libfdisk/src/gpt.c

index b6158fb45abeb9e700f2c8d2f9a4a7b5ebeed372..6962e7702e5e61532e177dd8e3b2d04e384b44d6 100644 (file)
@@ -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);