diff options
author | Karel Zak | 2015-04-22 17:13:48 +0200 |
---|---|---|
committer | Karel Zak | 2015-04-22 17:13:48 +0200 |
commit | 339ca8416c49553070c54b1f8f1043d59591ab3b (patch) | |
tree | 3dc3f040423aeef73a65136d734d32147f8b1d87 /libfdisk/src/partition.c | |
parent | libfdisk: add warning to resize function (diff) | |
download | kernel-qcow2-util-linux-339ca8416c49553070c54b1f8f1043d59591ab3b.tar.gz kernel-qcow2-util-linux-339ca8416c49553070c54b1f8f1043d59591ab3b.tar.xz kernel-qcow2-util-linux-339ca8416c49553070c54b1f8f1043d59591ab3b.zip |
libfdisk: allow to move start to first usable LBA
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'libfdisk/src/partition.c')
-rw-r--r-- | libfdisk/src/partition.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/libfdisk/src/partition.c b/libfdisk/src/partition.c index 84de63280..e892e9dd8 100644 --- a/libfdisk/src/partition.c +++ b/libfdisk/src/partition.c @@ -1037,12 +1037,12 @@ static int recount_resize( /* 2) verify that start is within the current partition or any freespace area */ if (!FDISK_IS_UNDEF(start)) { struct fdisk_partition *area = resize_get_by_offset(tb, start); - if (!area) - goto erange; if (area == cur) DBG(PART, ul_debugobj(tpl, "resize: start points to the current partition")); - else if (fdisk_partition_is_freespace(area)) + else if (area && fdisk_partition_is_freespace(area)) DBG(PART, ul_debugobj(tpl, "resize: start points to freespace")); + else if (!area && start >= cxt->first_lba && start < cxt->first_lba + (cxt->grain / cxt->sector_size)) + DBG(PART, ul_debugobj(tpl, "resize: start points before first partition")); else goto erange; } else { @@ -1096,7 +1096,7 @@ static int recount_resize( return 0; erange: DBG(PART, ul_debugobj(tpl, "resize: FAILED")); - fdisk_warnx(cxt, _("failed to resize partition #%zu."), partno + 1); + fdisk_warnx(cxt, _("Failed to resize partition #%zu."), partno + 1); fdisk_unref_table(tb); return -ERANGE; |