[git commit master 1/1] nandwrite: complain on malformed -s NUM

Denys Vlasenko vda.linux at googlemail.com
Sun Aug 29 11:29:02 UTC 2010


commit: http://git.busybox.net/busybox/commit/?id=b32a5436633f53f0abf0fa29105cf7e5b65091cf
branch: http://git.busybox.net/busybox/commit/?id=refs/heads/master

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

Signed-off-by: Denys Vlasenko <vda.linux at googlemail.com>
---
 coreutils/printf.c    |    4 ++--
 miscutils/nandwrite.c |    2 ++
 procps/kill.c         |    4 ++--
 procps/renice.c       |    2 +-
 shell/shell_common.c  |    2 +-
 5 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/coreutils/printf.c b/coreutils/printf.c
index 3497148..2cc2384 100644
--- a/coreutils/printf.c
+++ b/coreutils/printf.c
@@ -66,7 +66,7 @@ static int multiconvert(const char *arg, void *result, converter convert)
 	errno = 0;
 	convert(arg, result);
 	if (errno) {
-		bb_error_msg("%s: invalid number", arg);
+		bb_error_msg("invalid number '%s'", arg);
 		return 1;
 	}
 	return 0;
@@ -230,7 +230,7 @@ static int get_width_prec(const char *str)
 {
 	int v = bb_strtoi(str, NULL, 10);
 	if (errno) {
-		bb_error_msg("%s: invalid number", str);
+		bb_error_msg("invalid number '%s'", str);
 		v = 0;
 	}
 	return v;
diff --git a/miscutils/nandwrite.c b/miscutils/nandwrite.c
index d0e4397..8df0fdc 100644
--- a/miscutils/nandwrite.c
+++ b/miscutils/nandwrite.c
@@ -72,6 +72,8 @@ int nandwrite_main(int argc UNUSED_PARAM, char **argv)
 	xioctl(fd, MEMGETINFO, &meminfo);
 
 	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 */
 	meminfo_writesize = meminfo.writesize;
diff --git a/procps/kill.c b/procps/kill.c
index 4ed94b0..b51d44a 100644
--- a/procps/kill.c
+++ b/procps/kill.c
@@ -153,7 +153,7 @@ int kill_main(int argc, char **argv)
 					arg = argv[i];
 				omit = bb_strtoi(arg, NULL, 10);
 				if (errno) {
-					bb_error_msg("bad pid '%s'", arg);
+					bb_error_msg("invalid number '%s'", arg);
 					ret = 1;
 					goto resume;
 				}
@@ -211,7 +211,7 @@ int kill_main(int argc, char **argv)
 			arg++;
 		pid = bb_strtoi(arg, NULL, 10);
 		if (errno) {
-			bb_error_msg("bad pid '%s'", arg);
+			bb_error_msg("invalid number '%s'", arg);
 			errors++;
 		} else if (kill(pid, signo) != 0) {
 			bb_perror_msg("can't kill pid %d", (int)pid);
diff --git a/procps/renice.c b/procps/renice.c
index 81ee89c..0a73cbe 100644
--- a/procps/renice.c
+++ b/procps/renice.c
@@ -91,7 +91,7 @@ int renice_main(int argc UNUSED_PARAM, char **argv)
 		} else {
 			who = bb_strtou(arg, NULL, 10);
 			if (errno) {
-				bb_error_msg("bad value: %s", arg);
+				bb_error_msg("invalid number '%s'", arg);
 				goto HAD_ERROR;
 			}
 		}
diff --git a/shell/shell_common.c b/shell/shell_common.c
index 9345005..e9effd2 100644
--- a/shell/shell_common.c
+++ b/shell/shell_common.c
@@ -422,7 +422,7 @@ shell_builtin_ulimit(char **argv)
 						else
 							val = bb_strtoull(val_str, NULL, 10);
 						if (errno) {
-							bb_error_msg("bad number");
+							bb_error_msg("invalid number '%s'", val_str);
 							return EXIT_FAILURE;
 						}
 						val <<= l->factor_shift;
-- 
1.7.1



More information about the busybox-cvs mailing list