diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2019-10-04 16:45:04 +0200 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2019-10-04 16:45:04 +0200 |
commit | d8e4ce05039a89c2e0b41f008d74a83db45f2287 (patch) | |
tree | 147536311a6c19a12b331b02dd6b2819b48fae23 /util-linux/fdisk_sun.c | |
parent | 65741d004ee91c5a710559ae4f1664f25009255e (diff) | |
download | busybox-w32-d8e4ce05039a89c2e0b41f008d74a83db45f2287.tar.gz busybox-w32-d8e4ce05039a89c2e0b41f008d74a83db45f2287.tar.bz2 busybox-w32-d8e4ce05039a89c2e0b41f008d74a83db45f2287.zip |
fdisk: avoid overflow in "mega/gigabytes" calculation, code shrink
function old new delta
list_disk_geometry 175 145 -30
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 | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/util-linux/fdisk_sun.c b/util-linux/fdisk_sun.c index 3697a69b9..29d7c283a 100644 --- a/util-linux/fdisk_sun.c +++ b/util-linux/fdisk_sun.c | |||
@@ -491,7 +491,7 @@ add_sun_partition(int n, int sys) | |||
491 | return; | 491 | return; |
492 | } | 492 | } |
493 | } | 493 | } |
494 | snprintf(mesg, sizeof(mesg), "First %s", str_units(SINGULAR)); | 494 | snprintf(mesg, sizeof(mesg), "First %s", str_units()); |
495 | while (1) { | 495 | while (1) { |
496 | if (whole_disk) | 496 | if (whole_disk) |
497 | first = read_int(0, 0, 0, 0, mesg); | 497 | first = read_int(0, 0, 0, 0, mesg); |
@@ -546,7 +546,7 @@ and is of type 'Whole disk'\n"); | |||
546 | } | 546 | } |
547 | snprintf(mesg, sizeof(mesg), | 547 | snprintf(mesg, sizeof(mesg), |
548 | "Last %s or +size or +sizeM or +sizeK", | 548 | "Last %s or +size or +sizeM or +sizeK", |
549 | str_units(SINGULAR)); | 549 | str_units()); |
550 | if (whole_disk) | 550 | if (whole_disk) |
551 | last = read_int(scround(stop2), scround(stop2), scround(stop2), | 551 | last = read_int(scround(stop2), scround(stop2), scround(stop2), |
552 | 0, mesg); | 552 | 0, mesg); |
@@ -567,8 +567,8 @@ and is of type 'Whole disk'\n"); | |||
567 | "You haven't covered the whole disk with the 3rd partition,\n" | 567 | "You haven't covered the whole disk with the 3rd partition,\n" |
568 | "but your value %u %s covers some other partition.\n" | 568 | "but your value %u %s covers some other partition.\n" |
569 | "Your entry has been changed to %u %s\n", | 569 | "Your entry has been changed to %u %s\n", |
570 | scround(last), str_units(SINGULAR), | 570 | scround(last), str_units(), |
571 | scround(stop), str_units(SINGULAR)); | 571 | scround(stop), str_units()); |
572 | last = stop; | 572 | last = stop; |
573 | } | 573 | } |
574 | } else if (!whole_disk && last > stop) | 574 | } else if (!whole_disk && last > stop) |
@@ -636,20 +636,20 @@ sun_list_table(int xtra) | |||
636 | "%u cylinders, %u alternate cylinders, %u physical cylinders\n" | 636 | "%u cylinders, %u alternate cylinders, %u physical cylinders\n" |
637 | "%u extra sects/cyl, interleave %u:1\n" | 637 | "%u extra sects/cyl, interleave %u:1\n" |
638 | "%s\n" | 638 | "%s\n" |
639 | "Units = %s of %u * 512 bytes\n\n", | 639 | "Units = %ss of %u * 512 bytes\n\n", |
640 | disk_device, g_heads, g_sectors, SUN_SSWAP16(sunlabel->rspeed), | 640 | disk_device, g_heads, g_sectors, SUN_SSWAP16(sunlabel->rspeed), |
641 | g_cylinders, SUN_SSWAP16(sunlabel->nacyl), | 641 | g_cylinders, SUN_SSWAP16(sunlabel->nacyl), |
642 | SUN_SSWAP16(sunlabel->pcylcount), | 642 | SUN_SSWAP16(sunlabel->pcylcount), |
643 | SUN_SSWAP16(sunlabel->sparecyl), | 643 | SUN_SSWAP16(sunlabel->sparecyl), |
644 | SUN_SSWAP16(sunlabel->ilfact), | 644 | SUN_SSWAP16(sunlabel->ilfact), |
645 | (char *)sunlabel, | 645 | (char *)sunlabel, |
646 | str_units(PLURAL), units_per_sector); | 646 | str_units(), units_per_sector); |
647 | else | 647 | else |
648 | printf( | 648 | printf( |
649 | "\nDisk %s (Sun disk label): %u heads, %u sectors, %u cylinders\n" | 649 | "\nDisk %s (Sun disk label): %u heads, %u sectors, %u cylinders\n" |
650 | "Units = %s of %u * 512 bytes\n\n", | 650 | "Units = %ss of %u * 512 bytes\n\n", |
651 | disk_device, g_heads, g_sectors, g_cylinders, | 651 | disk_device, g_heads, g_sectors, g_cylinders, |
652 | str_units(PLURAL), units_per_sector); | 652 | str_units(), units_per_sector); |
653 | 653 | ||
654 | printf("%*s Flag Start End Blocks Id System\n", | 654 | printf("%*s Flag Start End Blocks Id System\n", |
655 | w + 1, "Device"); | 655 | w + 1, "Device"); |