diff options
author | Karel Zak | 2014-10-15 12:17:40 +0200 |
---|---|---|
committer | Karel Zak | 2014-10-15 12:17:40 +0200 |
commit | ecf40cda764496d3d1b29435ea64a65335ae0acf (patch) | |
tree | 9ef1d00a3906fd495194b88ca5023c9729353df0 /disk-utils/cfdisk.c | |
parent | tests: check for wipefs and helpers in fdisk tests (diff) | |
download | kernel-qcow2-util-linux-ecf40cda764496d3d1b29435ea64a65335ae0acf.tar.gz kernel-qcow2-util-linux-ecf40cda764496d3d1b29435ea64a65335ae0acf.tar.xz kernel-qcow2-util-linux-ecf40cda764496d3d1b29435ea64a65335ae0acf.zip |
libfdisk: make it possible to use zero for size and start
The zero may be valid size and start of the partition. This patch
introduces:
fdisk_partition_has_start()
fdisk_partition_has_size()
fdisk_partition_unset_size()
fdisk_partition_unset_start()
to make it possible to work with zero. The feature is internally
implemented by magic constant ((type) -1) for undefined sizes and
offsets.
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'disk-utils/cfdisk.c')
-rw-r--r-- | disk-utils/cfdisk.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/disk-utils/cfdisk.c b/disk-utils/cfdisk.c index 1f2ad7c49..496871311 100644 --- a/disk-utils/cfdisk.c +++ b/disk-utils/cfdisk.c @@ -1812,7 +1812,8 @@ static int main_menu_action(struct cfdisk *cf, int key) struct fdisk_partition *npa; /* the new partition */ int expsize = 0; /* size specified explicitly in sectors */ - if (!pa || !fdisk_partition_is_freespace(pa)) + if (!pa || !fdisk_partition_is_freespace(pa) + || !fdisk_partition_has_start(pa)) return -EINVAL; npa = fdisk_new_partition(); if (!npa) |