From bf3baa99075f6df0bea4cd857aa340694339dd9d Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Thu, 7 Dec 2006 00:26:33 +0100 Subject: Imported from util-linux-2.12p tarball. --- fdisk/fdisksunlabel.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'fdisk/fdisksunlabel.c') 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) -- cgit v1.2.3