aboutsummaryrefslogtreecommitdiff
path: root/util-linux
diff options
context:
space:
mode:
Diffstat (limited to 'util-linux')
-rw-r--r--util-linux/dmesg.c4
-rw-r--r--util-linux/fbset.c30
-rw-r--r--util-linux/fdisk.c13
-rw-r--r--util-linux/hexdump.c4
-rw-r--r--util-linux/ipcs.c2
-rw-r--r--util-linux/losetup.c4
-rw-r--r--util-linux/mount.c2
-rw-r--r--util-linux/readprofile.c6
8 files changed, 32 insertions, 33 deletions
diff --git a/util-linux/dmesg.c b/util-linux/dmesg.c
index 277415a2d..658cddc38 100644
--- a/util-linux/dmesg.c
+++ b/util-linux/dmesg.c
@@ -19,13 +19,13 @@ int dmesg_main(int argc, char *argv[])
19 int flags = getopt32(argc, argv, "cs:n:", &size, &level); 19 int flags = getopt32(argc, argv, "cs:n:", &size, &level);
20 20
21 if (flags & 4) { 21 if (flags & 4) {
22 if (klogctl(8, NULL, bb_xgetlarg(level, 10, 0, 10))) 22 if (klogctl(8, NULL, xatoul_range(level, 0, 10)))
23 bb_perror_msg_and_die("klogctl"); 23 bb_perror_msg_and_die("klogctl");
24 } else { 24 } else {
25 int len; 25 int len;
26 char *buf; 26 char *buf;
27 27
28 len = (flags & 2) ? bb_xgetlarg(size, 10, 2, INT_MAX) : 16384; 28 len = (flags & 2) ? xatoul_range(size, 2, INT_MAX) : 16384;
29 buf = xmalloc(len); 29 buf = xmalloc(len);
30 if (0 > (len = klogctl(3 + (flags & 1), buf, len))) 30 if (0 > (len = klogctl(3 + (flags & 1), buf, len)))
31 bb_perror_msg_and_die("klogctl"); 31 bb_perror_msg_and_die("klogctl");
diff --git a/util-linux/fbset.c b/util-linux/fbset.c
index bc8ec1806..1aa0a0ac1 100644
--- a/util-linux/fbset.c
+++ b/util-linux/fbset.c
@@ -338,20 +338,20 @@ int fbset_main(int argc, char **argv)
338 modefile = argv[1]; 338 modefile = argv[1];
339 break; 339 break;
340 case CMD_GEOMETRY: 340 case CMD_GEOMETRY:
341 varset.xres = strtoul(argv[1], 0, 0); 341 varset.xres = xatou32(argv[1]);
342 varset.yres = strtoul(argv[2], 0, 0); 342 varset.yres = xatou32(argv[2]);
343 varset.xres_virtual = strtoul(argv[3], 0, 0); 343 varset.xres_virtual = xatou32(argv[3]);
344 varset.yres_virtual = strtoul(argv[4], 0, 0); 344 varset.yres_virtual = xatou32(argv[4]);
345 varset.bits_per_pixel = strtoul(argv[5], 0, 0); 345 varset.bits_per_pixel = xatou32(argv[5]);
346 break; 346 break;
347 case CMD_TIMING: 347 case CMD_TIMING:
348 varset.pixclock = strtoul(argv[1], 0, 0); 348 varset.pixclock = xatou32(argv[1]);
349 varset.left_margin = strtoul(argv[2], 0, 0); 349 varset.left_margin = xatou32(argv[2]);
350 varset.right_margin = strtoul(argv[3], 0, 0); 350 varset.right_margin = xatou32(argv[3]);
351 varset.upper_margin = strtoul(argv[4], 0, 0); 351 varset.upper_margin = xatou32(argv[4]);
352 varset.lower_margin = strtoul(argv[5], 0, 0); 352 varset.lower_margin = xatou32(argv[5]);
353 varset.hsync_len = strtoul(argv[6], 0, 0); 353 varset.hsync_len = xatou32(argv[6]);
354 varset.vsync_len = strtoul(argv[7], 0, 0); 354 varset.vsync_len = xatou32(argv[7]);
355 break; 355 break;
356 case CMD_ALL: 356 case CMD_ALL:
357 g_options |= OPT_ALL; 357 g_options |= OPT_ALL;
@@ -361,13 +361,13 @@ int fbset_main(int argc, char **argv)
361 break; 361 break;
362#ifdef CONFIG_FEATURE_FBSET_FANCY 362#ifdef CONFIG_FEATURE_FBSET_FANCY
363 case CMD_XRES: 363 case CMD_XRES:
364 varset.xres = strtoul(argv[1], 0, 0); 364 varset.xres = xatou32(argv[1]);
365 break; 365 break;
366 case CMD_YRES: 366 case CMD_YRES:
367 varset.yres = strtoul(argv[1], 0, 0); 367 varset.yres = xatou32(argv[1]);
368 break; 368 break;
369 case CMD_DEPTH: 369 case CMD_DEPTH:
370 varset.bits_per_pixel = strtoul(argv[1], 0, 0); 370 varset.bits_per_pixel = xatou32(argv[1]);
371 break; 371 break;
372#endif 372#endif
373 } 373 }
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;
diff --git a/util-linux/hexdump.c b/util-linux/hexdump.c
index e038005f5..03b222dd0 100644
--- a/util-linux/hexdump.c
+++ b/util-linux/hexdump.c
@@ -79,10 +79,10 @@ int hexdump_main(int argc, char **argv)
79 bb_dump_addfile(optarg); 79 bb_dump_addfile(optarg);
80 } /* else */ 80 } /* else */
81 if (ch == 'n') { 81 if (ch == 'n') {
82 bb_dump_length = bb_xgetularg10_bnd(optarg, 0, INT_MAX); 82 bb_dump_length = xatoi_u(optarg);
83 } /* else */ 83 } /* else */
84 if (ch == 's') { 84 if (ch == 's') {
85 bb_dump_skip = bb_xgetularg_bnd_sfx(optarg, 10, 0, LONG_MAX, suffixes); 85 bb_dump_skip = xatoul_range_sfx(optarg, 0, LONG_MAX, suffixes);
86 } /* else */ 86 } /* else */
87 if (ch == 'v') { 87 if (ch == 'v') {
88 bb_dump_vflag = ALL; 88 bb_dump_vflag = ALL;
diff --git a/util-linux/ipcs.c b/util-linux/ipcs.c
index 5e58e81da..ba81ea97c 100644
--- a/util-linux/ipcs.c
+++ b/util-linux/ipcs.c
@@ -581,7 +581,7 @@ int ipcs_main(int argc, char **argv)
581 581
582 opt = getopt32(argc, argv, "i:aqsmtcplu", &opt_i); 582 opt = getopt32(argc, argv, "i:aqsmtcplu", &opt_i);
583 if (opt & 0x1) { // -i 583 if (opt & 0x1) { // -i
584 id = atoi(opt_i); 584 id = xatoi(opt_i);
585 flags |= flag_print; 585 flags |= flag_print;
586 } 586 }
587 if (opt & 0x2) flags |= flag_msg | flag_sem | flag_shm; // -a 587 if (opt & 0x2) flags |= flag_msg | flag_sem | flag_shm; // -a
diff --git a/util-linux/losetup.c b/util-linux/losetup.c
index 8882ee4da..c7eb85a91 100644
--- a/util-linux/losetup.c
+++ b/util-linux/losetup.c
@@ -16,7 +16,7 @@ int losetup_main(int argc, char **argv)
16{ 16{
17 unsigned opt; 17 unsigned opt;
18 char *opt_o; 18 char *opt_o;
19 int offset = 0; 19 unsigned long long offset = 0;
20 20
21 opt = getopt32(argc, argv, "do:", &opt_o); 21 opt = getopt32(argc, argv, "do:", &opt_o);
22 argc -= optind; 22 argc -= optind;
@@ -35,7 +35,7 @@ int losetup_main(int argc, char **argv)
35 } 35 }
36 36
37 if (opt == 0x2) // -o 37 if (opt == 0x2) // -o
38 offset = bb_xparse_number(opt_o, NULL); 38 offset = xatoull(opt_o);
39 39
40 /* -o or no option */ 40 /* -o or no option */
41 41
diff --git a/util-linux/mount.c b/util-linux/mount.c
index 141517ba0..531fb4520 100644
--- a/util-linux/mount.c
+++ b/util-linux/mount.c
@@ -856,7 +856,7 @@ static int nfsmount(struct mntent *mp, int vfsflags, char *filteropts)
856 for (opt = strtok(filteropts, ","); opt; opt = strtok(NULL, ",")) { 856 for (opt = strtok(filteropts, ","); opt; opt = strtok(NULL, ",")) {
857 char *opteq = strchr(opt, '='); 857 char *opteq = strchr(opt, '=');
858 if (opteq) { 858 if (opteq) {
859 int val = atoi(opteq + 1); 859 int val = xatoi_u(opteq + 1);
860 *opteq = '\0'; 860 *opteq = '\0';
861 if (!strcmp(opt, "rsize")) 861 if (!strcmp(opt, "rsize"))
862 data.rsize = val; 862 data.rsize = val;
diff --git a/util-linux/readprofile.c b/util-linux/readprofile.c
index ff70bf79b..b368067ef 100644
--- a/util-linux/readprofile.c
+++ b/util-linux/readprofile.c
@@ -38,8 +38,8 @@
38#define S_LEN 128 38#define S_LEN 128
39 39
40/* These are the defaults */ 40/* These are the defaults */
41static const char defaultmap[]="/boot/System.map"; 41static const char defaultmap[] = "/boot/System.map";
42static const char defaultpro[]="/proc/profile"; 42static const char defaultpro[] = "/proc/profile";
43 43
44int readprofile_main(int argc, char **argv) 44int readprofile_main(int argc, char **argv)
45{ 45{
@@ -78,7 +78,7 @@ int readprofile_main(int argc, char **argv)
78 * not sizeof(int), the multiplier is not changed 78 * not sizeof(int), the multiplier is not changed
79 */ 79 */
80 if (mult) { 80 if (mult) {
81 multiplier = strtoul(mult, 0, 10); 81 multiplier = xatoi_u(mult);
82 to_write = sizeof(int); 82 to_write = sizeof(int);
83 } else { 83 } else {
84 multiplier = 0; 84 multiplier = 0;