diff options
author | Karel Zak <kzak@redhat.com> | 2006-12-07 00:26:33 +0100 |
---|---|---|
committer | Karel Zak <kzak@redhat.com> | 2006-12-07 00:26:33 +0100 |
commit | bf3baa99075f6df0bea4cd857aa340694339dd9d (patch) | |
tree | 9dba6996348ddc430c30fb9fa0737963c25f283b /fdisk/fdisksunlabel.c | |
parent | 756bfd018eb393640dad490df1a1ca840d9ee79b (diff) | |
download | util-linux-old-bf3baa99075f6df0bea4cd857aa340694339dd9d.tar.gz |
Imported from util-linux-2.12p tarball.
Diffstat (limited to 'fdisk/fdisksunlabel.c')
-rw-r--r-- | fdisk/fdisksunlabel.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/fdisk/fdisksunlabel.c b/fdisk/fdisksunlabel.c index f4a67bd9..eab67c01 100644 --- a/fdisk/fdisksunlabel.c +++ b/fdisk/fdisksunlabel.c @@ -524,9 +524,14 @@ add_sun_partition(int n, int sys) { scround(stop), 0, mesg); if (display_in_cyl_units) first *= units_per_sector; - else + else { /* Starting sector has to be properly aligned */ - first = (first + heads * sectors - 1) / (heads * sectors); + int cs = heads * sectors; + int x = first % cs; + + if (x) + first += cs - x; + } if (n == 2 && first != 0) printf ("\ It is highly recommended that the third partition covers the whole disk\n\ @@ -560,7 +565,7 @@ and is of type `Whole disk'\n"); } else break; } - stop = cylinders * heads * sectors; + stop = cylinders * heads * sectors; /* ancient */ stop2 = stop; for (i = 0; i < partitions; i++) { if (starts[i] > first && starts[i] < stop) |