diff options
author | Karel Zak | 2010-02-09 11:06:42 +0100 |
---|---|---|
committer | Karel Zak | 2010-02-09 11:06:42 +0100 |
commit | 7ded5afc571b39ba15cf9f649506a986b00c1af1 (patch) | |
tree | d35ea4b489349fe633d732b6875287bad8fef2f6 /fdisk/fdisk.c | |
parent | fdisk: cleanup alignment, default to 1MiB offset (diff) | |
download | kernel-qcow2-util-linux-7ded5afc571b39ba15cf9f649506a986b00c1af1.tar.gz kernel-qcow2-util-linux-7ded5afc571b39ba15cf9f649506a986b00c1af1.tar.xz kernel-qcow2-util-linux-7ded5afc571b39ba15cf9f649506a986b00c1af1.zip |
fdisk: fix default first sector
The previous release 2.17 introduces aligned defaults for the first
and last sectors on the partition. Unfortunately, there is endless
loop when the code looks for first unused aligned sector.
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'fdisk/fdisk.c')
-rw-r--r-- | fdisk/fdisk.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/fdisk/fdisk.c b/fdisk/fdisk.c index dc5dfb9d9..ddfd24d1e 100644 --- a/fdisk/fdisk.c +++ b/fdisk/fdisk.c @@ -2309,17 +2309,16 @@ add_partition(int n, int sys) { snprintf(mesg, sizeof(mesg), _("First %s"), str_units(SINGULAR)); do { - unsigned long long dflt, dflt_tmp; + unsigned long long dflt, aligned; temp = start; - dflt = start = get_unused_start(n, start, first, last); /* the default sector should be aligned and unused */ do { - dflt_tmp = align_lba_in_range(dflt, start, limit); - dflt = get_unused_start(n, dflt_tmp, first, last); - } while (dflt != dflt_tmp && dflt > dflt_tmp && dflt < limit); + aligned = align_lba_in_range(dflt, dflt, limit); + dflt = get_unused_start(n, aligned, first, last); + } while (dflt != aligned && dflt > aligned && dflt < limit); if (dflt >= limit) dflt = start; |