diff options
author | Denis Vlasenko <vda.linux@googlemail.com> | 2006-10-08 12:49:22 +0000 |
---|---|---|
committer | Denis Vlasenko <vda.linux@googlemail.com> | 2006-10-08 12:49:22 +0000 |
commit | 1385899416a4396385ad421ae1f532be7103738a (patch) | |
tree | fc4d14a910593d1235318bb36abe5e9f72d2039e /util-linux/fdisk.c | |
parent | 5625415085e68ac5e150f54e685417c866620d76 (diff) | |
download | busybox-w32-1385899416a4396385ad421ae1f532be7103738a.tar.gz busybox-w32-1385899416a4396385ad421ae1f532be7103738a.tar.bz2 busybox-w32-1385899416a4396385ad421ae1f532be7103738a.zip |
attempt to regularize atoi mess.
Diffstat (limited to 'util-linux/fdisk.c')
-rw-r--r-- | util-linux/fdisk.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/util-linux/fdisk.c b/util-linux/fdisk.c index 85acaa4aa..3bf78ee04 100644 --- a/util-linux/fdisk.c +++ b/util-linux/fdisk.c | |||
@@ -1222,8 +1222,7 @@ edit_int(int def, char *mesg) | |||
1222 | printf(" (%d): ", def); | 1222 | printf(" (%d): ", def); |
1223 | if (!read_line()) | 1223 | if (!read_line()) |
1224 | return def; | 1224 | return def; |
1225 | } | 1225 | } while (!isdigit(*line_ptr)); |
1226 | while (!isdigit(*line_ptr)); /* FIXME: ?!! */ | ||
1227 | return atoi(line_ptr); | 1226 | return atoi(line_ptr); |
1228 | } | 1227 | } |
1229 | 1228 | ||
@@ -5664,14 +5663,14 @@ int fdisk_main(int argc, char **argv) | |||
5664 | #ifdef CONFIG_FEATURE_FDISK_BLKSIZE | 5663 | #ifdef CONFIG_FEATURE_FDISK_BLKSIZE |
5665 | "s" | 5664 | "s" |
5666 | #endif | 5665 | #endif |
5667 | )) != -1) { | 5666 | )) != -1) { |
5668 | switch (c) { | 5667 | switch (c) { |
5669 | case 'b': | 5668 | case 'b': |
5670 | /* Ugly: this sector size is really per device, | 5669 | /* Ugly: this sector size is really per device, |
5671 | so cannot be combined with multiple disks, | 5670 | so cannot be combined with multiple disks, |
5672 | and te same goes for the C/H/S options. | 5671 | and te same goes for the C/H/S options. |
5673 | */ | 5672 | */ |
5674 | sector_size = atoi(optarg); | 5673 | sector_size = xatoi_u(optarg); |
5675 | if (sector_size != 512 && sector_size != 1024 && | 5674 | if (sector_size != 512 && sector_size != 1024 && |
5676 | sector_size != 2048) | 5675 | sector_size != 2048) |
5677 | bb_show_usage(); | 5676 | bb_show_usage(); |
@@ -5679,15 +5678,15 @@ int fdisk_main(int argc, char **argv) | |||
5679 | user_set_sector_size = 1; | 5678 | user_set_sector_size = 1; |
5680 | break; | 5679 | break; |
5681 | case 'C': | 5680 | case 'C': |
5682 | user_cylinders = atoi(optarg); | 5681 | user_cylinders = xatoi_u(optarg); |
5683 | break; | 5682 | break; |
5684 | case 'H': | 5683 | case 'H': |
5685 | user_heads = atoi(optarg); | 5684 | user_heads = xatoi_u(optarg); |
5686 | if (user_heads <= 0 || user_heads >= 256) | 5685 | if (user_heads <= 0 || user_heads >= 256) |
5687 | user_heads = 0; | 5686 | user_heads = 0; |
5688 | break; | 5687 | break; |
5689 | case 'S': | 5688 | case 'S': |
5690 | user_sectors = atoi(optarg); | 5689 | user_sectors = xatoi_u(optarg); |
5691 | if (user_sectors <= 0 || user_sectors >= 64) | 5690 | if (user_sectors <= 0 || user_sectors >= 64) |
5692 | user_sectors = 0; | 5691 | user_sectors = 0; |
5693 | break; | 5692 | break; |