]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
libfdisk: (dos) be more verbose on partno -ERANGE error
authorKarel Zak <kzak@redhat.com>
Mon, 19 Jun 2017 12:32:59 +0000 (14:32 +0200)
committerKarel Zak <kzak@redhat.com>
Mon, 19 Jun 2017 12:32:59 +0000 (14:32 +0200)
Signed-off-by: Karel Zak <kzak@redhat.com>
libfdisk/src/dos.c
libfdisk/src/partition.c

index 73660d8ce965ce958545f964835305ac23586d13..588635f00d79d830288791669cccbdd3249d0ecb 100644 (file)
@@ -212,8 +212,11 @@ static int get_partition_unused_primary(struct fdisk_context *cxt,
        if (rc == 1) {
                fdisk_info(cxt, _("All primary partitions have been defined already."));
                rc = -1;
+       } else if (rc == -ERANGE) {
+               fdisk_warnx(cxt, _("Primary partition not available."));
        } else if (rc == 0)
                *partno = n;
+
        return rc;
 }
 
index d27c161b4d09cf28c8c2e09750af5abf9185a9bf..95baea0c21b07f35021ff8983f6f372bd7eeb9b0 100644 (file)
@@ -702,11 +702,14 @@ int fdisk_partition_is_wholedisk(struct fdisk_partition *pa)
  * @cxt: context
  * @n: returns partition number
  *
- * If partno-follow-default (see fdisk_partition_partno_follow_default())
- * enabled then returns next expected partno, otherwise use Ask API to ask user
- * for the next partno.
+ * If @pa specified and partno-follow-default (see fdisk_partition_partno_follow_default())
+ * enabled then returns next expected partno or -ERANGE on error.
  *
- * Returns: 0 on success, <0 on error
+ * If @pa is NULL, or @pa does not specify any sepamntic for the next partno
+ * then use Ask API to ask user for the next partno. In this case returns 1 if
+ * no free partition avaialble.
+ *
+ * Returns: 0 on success, <0 on error, or 1 for non-free partno by Ask API.
  */
 int fdisk_partition_next_partno(
                struct fdisk_partition *pa,