]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
libfdisk: follow requested size rather than use all available space
authorKarel Zak <kzak@redhat.com>
Tue, 11 Mar 2014 11:16:14 +0000 (12:16 +0100)
committerKarel Zak <kzak@redhat.com>
Tue, 11 Mar 2014 11:16:14 +0000 (12:16 +0100)
Signed-off-by: Karel Zak <kzak@redhat.com>
libfdisk/src/gpt.c

index dac9e7107d5d70ed65a57d2091b4a264da86c61c..4920fe75ba9cb90e7dd1b80ae7c45993efb800be 100644 (file)
@@ -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;
                }