diff options
author | Aaro Koskinen <aaro.koskinen@iki.fi> | 2013-02-09 21:12:26 +0200 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2013-02-11 00:22:59 +0100 |
commit | cf5731bcbd3b65c5efb9a8b24ed6b95a0a239e67 (patch) | |
tree | 304bafa44c5909c5d591dd07948d9f24bd1f1017 /util-linux/fdisk_sun.c | |
parent | 1bd5ca2f530f11e27a1ae13bba592d9f725ce341 (diff) | |
download | busybox-w32-cf5731bcbd3b65c5efb9a8b24ed6b95a0a239e67.tar.gz busybox-w32-cf5731bcbd3b65c5efb9a8b24ed6b95a0a239e67.tar.bz2 busybox-w32-cf5731bcbd3b65c5efb9a8b24ed6b95a0a239e67.zip |
fdisk_sun: fix partition alignment
When the display unit is sectors, the partition alignment will convert
the partition start to a wrong unit (it should always be in sectors). Fix
this.
Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'util-linux/fdisk_sun.c')
-rw-r--r-- | util-linux/fdisk_sun.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/util-linux/fdisk_sun.c b/util-linux/fdisk_sun.c index d11c54012..e32740dea 100644 --- a/util-linux/fdisk_sun.c +++ b/util-linux/fdisk_sun.c | |||
@@ -498,11 +498,14 @@ add_sun_partition(int n, int sys) | |||
498 | else | 498 | else |
499 | first = read_int(scround(start), scround(stop)+1, | 499 | first = read_int(scround(start), scround(stop)+1, |
500 | scround(stop), 0, mesg); | 500 | scround(stop), 0, mesg); |
501 | if (display_in_cyl_units) | 501 | if (display_in_cyl_units) { |
502 | first *= units_per_sector; | 502 | first *= units_per_sector; |
503 | else | 503 | } else { |
504 | /* Starting sector has to be properly aligned */ | 504 | /* Starting sector has to be properly aligned */ |
505 | first = (first + g_heads * g_sectors - 1) / (g_heads * g_sectors); | 505 | first = (first + g_heads * g_sectors - 1) / |
506 | (g_heads * g_sectors); | ||
507 | first *= g_heads * g_sectors; | ||
508 | } | ||
506 | if (n == 2 && first != 0) | 509 | if (n == 2 && first != 0) |
507 | printf("\ | 510 | printf("\ |
508 | It is highly recommended that the third partition covers the whole disk\n\ | 511 | It is highly recommended that the third partition covers the whole disk\n\ |