summaryrefslogtreecommitdiffstats
path: root/fdisk/fdisksunlabel.c
diff options
context:
space:
mode:
Diffstat (limited to 'fdisk/fdisksunlabel.c')
-rw-r--r--fdisk/fdisksunlabel.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/fdisk/fdisksunlabel.c b/fdisk/fdisksunlabel.c
index f4a67bd92..eab67c015 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)