aboutsummaryrefslogtreecommitdiff
path: root/util-linux/fdisk_sgi.c
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2019-10-04 16:45:04 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2019-10-04 16:45:04 +0200
commitd8e4ce05039a89c2e0b41f008d74a83db45f2287 (patch)
tree147536311a6c19a12b331b02dd6b2819b48fae23 /util-linux/fdisk_sgi.c
parent65741d004ee91c5a710559ae4f1664f25009255e (diff)
downloadbusybox-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_sgi.c')
-rw-r--r--util-linux/fdisk_sgi.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/util-linux/fdisk_sgi.c b/util-linux/fdisk_sgi.c
index 0e5491a19..c90c801e2 100644
--- a/util-linux/fdisk_sgi.c
+++ b/util-linux/fdisk_sgi.c
@@ -295,19 +295,19 @@ sgi_list_table(int xtra)
295 "%u cylinders, %u physical cylinders\n" 295 "%u cylinders, %u physical cylinders\n"
296 "%u extra sects/cyl, interleave %u:1\n" 296 "%u extra sects/cyl, interleave %u:1\n"
297 "%s\n" 297 "%s\n"
298 "Units = %s of %u * 512 bytes\n\n", 298 "Units = %ss of %u * 512 bytes\n\n",
299 disk_device, g_heads, g_sectors, g_cylinders, 299 disk_device, g_heads, g_sectors, g_cylinders,
300 SGI_SSWAP16(sgiparam.pcylcount), 300 SGI_SSWAP16(sgiparam.pcylcount),
301 SGI_SSWAP16(sgiparam.sparecyl), 301 SGI_SSWAP16(sgiparam.sparecyl),
302 SGI_SSWAP16(sgiparam.ilfact), 302 SGI_SSWAP16(sgiparam.ilfact),
303 (char *)sgilabel, 303 (char *)sgilabel,
304 str_units(PLURAL), units_per_sector); 304 str_units(), units_per_sector);
305 } else { 305 } else {
306 printf("\nDisk %s (SGI disk label): " 306 printf("\nDisk %s (SGI disk label): "
307 "%u heads, %u sectors, %u cylinders\n" 307 "%u heads, %u sectors, %u cylinders\n"
308 "Units = %s of %u * 512 bytes\n\n", 308 "Units = %ss of %u * 512 bytes\n\n",
309 disk_device, g_heads, g_sectors, g_cylinders, 309 disk_device, g_heads, g_sectors, g_cylinders,
310 str_units(PLURAL), units_per_sector ); 310 str_units(), units_per_sector );
311 } 311 }
312 312
313 w = strlen(disk_device); 313 w = strlen(disk_device);
@@ -720,7 +720,7 @@ sgi_add_partition(int n, int sys)
720 printf("You got a partition overlap on the disk. Fix it first!\n"); 720 printf("You got a partition overlap on the disk. Fix it first!\n");
721 return; 721 return;
722 } 722 }
723 snprintf(mesg, sizeof(mesg), "First %s", str_units(SINGULAR)); 723 snprintf(mesg, sizeof(mesg), "First %s", str_units());
724 while (1) { 724 while (1) {
725 if (sys == SGI_VOLUME) { 725 if (sys == SGI_VOLUME) {
726 last = sgi_get_lastblock(); 726 last = sgi_get_lastblock();
@@ -746,7 +746,7 @@ sgi_add_partition(int n, int sys)
746 printf("You will get a partition overlap on the disk. " 746 printf("You will get a partition overlap on the disk. "
747 "Fix it first!\n"); 747 "Fix it first!\n");
748 } 748 }
749 snprintf(mesg, sizeof(mesg), " Last %s", str_units(SINGULAR)); 749 snprintf(mesg, sizeof(mesg), " Last %s", str_units());
750 last = read_int(scround(first), scround(last)-1, scround(last)-1, 750 last = read_int(scround(first), scround(last)-1, scround(last)-1,
751 scround(first), mesg)+1; 751 scround(first), mesg)+1;
752 if (display_in_cyl_units) 752 if (display_in_cyl_units)