summaryrefslogtreecommitdiffstats
path: root/libfdisk/src
diff options
context:
space:
mode:
authorKarel Zak2017-06-19 14:32:59 +0200
committerKarel Zak2017-06-19 14:32:59 +0200
commit53625d1ae9944b638f72ff43f6142f4e95a4aeda (patch)
tree5eff6839624a87fb38050f9258f12ec068e98b9a /libfdisk/src
parentmount: fix man page typo (--bind,ro) (diff)
downloadkernel-qcow2-util-linux-53625d1ae9944b638f72ff43f6142f4e95a4aeda.tar.gz
kernel-qcow2-util-linux-53625d1ae9944b638f72ff43f6142f4e95a4aeda.tar.xz
kernel-qcow2-util-linux-53625d1ae9944b638f72ff43f6142f4e95a4aeda.zip
libfdisk: (dos) be more verbose on partno -ERANGE error
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'libfdisk/src')
-rw-r--r--libfdisk/src/dos.c3
-rw-r--r--libfdisk/src/partition.c11
2 files changed, 10 insertions, 4 deletions
diff --git a/libfdisk/src/dos.c b/libfdisk/src/dos.c
index 73660d8ce..588635f00 100644
--- a/libfdisk/src/dos.c
+++ b/libfdisk/src/dos.c
@@ -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;
}
diff --git a/libfdisk/src/partition.c b/libfdisk/src/partition.c
index d27c161b4..95baea0c2 100644
--- a/libfdisk/src/partition.c
+++ b/libfdisk/src/partition.c
@@ -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,