nandwrite: complain on malformed -s NUM

Elsewhere: use common error message. -30 bytes net size change

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
Denys Vlasenko 2010-08-29 13:29:02 +02:00
parent a78227dc73
commit b32a543663
5 changed files with 8 additions and 6 deletions

View File

@ -66,7 +66,7 @@ static int multiconvert(const char *arg, void *result, converter convert)
errno = 0; errno = 0;
convert(arg, result); convert(arg, result);
if (errno) { if (errno) {
bb_error_msg("%s: invalid number", arg); bb_error_msg("invalid number '%s'", arg);
return 1; return 1;
} }
return 0; return 0;
@ -230,7 +230,7 @@ static int get_width_prec(const char *str)
{ {
int v = bb_strtoi(str, NULL, 10); int v = bb_strtoi(str, NULL, 10);
if (errno) { if (errno) {
bb_error_msg("%s: invalid number", str); bb_error_msg("invalid number '%s'", str);
v = 0; v = 0;
} }
return v; return v;

View File

@ -72,6 +72,8 @@ int nandwrite_main(int argc UNUSED_PARAM, char **argv)
xioctl(fd, MEMGETINFO, &meminfo); xioctl(fd, MEMGETINFO, &meminfo);
mtdoffset = bb_strtou(opt_s, NULL, 0); mtdoffset = bb_strtou(opt_s, NULL, 0);
if (errno)
bb_error_msg_and_die("invalid number '%s'", opt_s);
/* Pull it into a CPU register (hopefully) - smaller code that way */ /* Pull it into a CPU register (hopefully) - smaller code that way */
meminfo_writesize = meminfo.writesize; meminfo_writesize = meminfo.writesize;

View File

@ -153,7 +153,7 @@ int kill_main(int argc, char **argv)
arg = argv[i]; arg = argv[i];
omit = bb_strtoi(arg, NULL, 10); omit = bb_strtoi(arg, NULL, 10);
if (errno) { if (errno) {
bb_error_msg("bad pid '%s'", arg); bb_error_msg("invalid number '%s'", arg);
ret = 1; ret = 1;
goto resume; goto resume;
} }
@ -211,7 +211,7 @@ int kill_main(int argc, char **argv)
arg++; arg++;
pid = bb_strtoi(arg, NULL, 10); pid = bb_strtoi(arg, NULL, 10);
if (errno) { if (errno) {
bb_error_msg("bad pid '%s'", arg); bb_error_msg("invalid number '%s'", arg);
errors++; errors++;
} else if (kill(pid, signo) != 0) { } else if (kill(pid, signo) != 0) {
bb_perror_msg("can't kill pid %d", (int)pid); bb_perror_msg("can't kill pid %d", (int)pid);

View File

@ -91,7 +91,7 @@ int renice_main(int argc UNUSED_PARAM, char **argv)
} else { } else {
who = bb_strtou(arg, NULL, 10); who = bb_strtou(arg, NULL, 10);
if (errno) { if (errno) {
bb_error_msg("bad value: %s", arg); bb_error_msg("invalid number '%s'", arg);
goto HAD_ERROR; goto HAD_ERROR;
} }
} }

View File

@ -422,7 +422,7 @@ shell_builtin_ulimit(char **argv)
else else
val = bb_strtoull(val_str, NULL, 10); val = bb_strtoull(val_str, NULL, 10);
if (errno) { if (errno) {
bb_error_msg("bad number"); bb_error_msg("invalid number '%s'", val_str);
return EXIT_FAILURE; return EXIT_FAILURE;
} }
val <<= l->factor_shift; val <<= l->factor_shift;