diff options
Diffstat (limited to 'libfdisk/src/partition.c')
-rw-r--r-- | libfdisk/src/partition.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/libfdisk/src/partition.c b/libfdisk/src/partition.c index daa73a4ed..bc52ea573 100644 --- a/libfdisk/src/partition.c +++ b/libfdisk/src/partition.c @@ -705,9 +705,9 @@ int fdisk_partition_is_wholedisk(struct fdisk_partition *pa) * If @pa specified and partno-follow-default (see fdisk_partition_partno_follow_default()) * enabled then returns next expected partno or -ERANGE on error. * - * If @pa is NULL, or @pa does not specify any sepamntic for the next partno + * If @pa is NULL, or @pa does not specify any semantic 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. + * no free partition avaialble. If fdisk dialogs are disabled then returns -EINVAL. * * Returns: 0 on success, <0 on error, or 1 for non-free partno by Ask API. */ @@ -740,10 +740,12 @@ int fdisk_partition_next_partno( fdisk_is_partition_used(cxt, pa->partno)) return -ERANGE; *n = pa->partno; - } else + return 0; + + } else if (fdisk_has_dialogs(cxt)) return fdisk_ask_partnum(cxt, n, 1); - return 0; + return -EINVAL; } static int probe_partition_content(struct fdisk_context *cxt, struct fdisk_partition *pa) |