From: Karel Zak Date: Tue, 11 Mar 2014 11:16:14 +0000 (+0100) Subject: libfdisk: follow requested size rather than use all available space X-Git-Tag: v2.25-rc1~444 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8d6ec09abaab37b6facc22829ca26b589b4c6fde;p=thirdparty%2Futil-linux.git libfdisk: follow requested size rather than use all available space Signed-off-by: Karel Zak --- diff --git a/libfdisk/src/gpt.c b/libfdisk/src/gpt.c index dac9e7107d..4920fe75ba 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; }