summaryrefslogtreecommitdiffstats
path: root/libfdisk
diff options
context:
space:
mode:
authorKarel Zak2014-03-11 12:16:14 +0100
committerKarel Zak2014-03-11 12:16:14 +0100
commit8d6ec09abaab37b6facc22829ca26b589b4c6fde (patch)
tree88a24ee146eea3270f07c8933f7a1e7afd7cbe6d /libfdisk
parentlib/colors: fix colors test (diff)
downloadkernel-qcow2-util-linux-8d6ec09abaab37b6facc22829ca26b589b4c6fde.tar.gz
kernel-qcow2-util-linux-8d6ec09abaab37b6facc22829ca26b589b4c6fde.tar.xz
kernel-qcow2-util-linux-8d6ec09abaab37b6facc22829ca26b589b4c6fde.zip
libfdisk: follow requested size rather than use all available space
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'libfdisk')
-rw-r--r--libfdisk/src/gpt.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/libfdisk/src/gpt.c b/libfdisk/src/gpt.c
index dac9e7107..4920fe75b 100644
--- a/libfdisk/src/gpt.c
+++ b/libfdisk/src/gpt.c
@@ -1824,8 +1824,10 @@ static int gpt_add_partition(
user_l = user_f + pa->size;
user_l = fdisk_align_lba_in_range(cxt, user_l, user_f, dflt_l) - 1;
+ /* no space for anything useful, use all space
if (user_l + (cxt->grain / cxt->sector_size) > dflt_l)
- user_l = dflt_l; /* no space for anything useful, use all space */
+ user_l = dflt_l;
+ */
} else if (pa && pa->end_follow_default) {
user_l = dflt_l;
@@ -1851,8 +1853,11 @@ static int gpt_add_partition(
user_l = fdisk_ask_number_get_result(ask);
if (fdisk_ask_number_is_relative(ask)) {
user_l = fdisk_align_lba_in_range(cxt, user_l, user_f, dflt_l) - 1;
+
+ /* no space for anything useful, use all space
if (user_l + (cxt->grain / cxt->sector_size) > dflt_l)
- user_l = dflt_l; /* no space for anything useful, use all space */
+ user_l = dflt_l;
+ */
} if (user_l > user_f && user_l <= disk_l)
break;
}