diff options
author | Denis Vlasenko <vda.linux@googlemail.com> | 2008-06-18 19:22:19 +0000 |
---|---|---|
committer | Denis Vlasenko <vda.linux@googlemail.com> | 2008-06-18 19:22:19 +0000 |
commit | 9cd4c76b50b8fde9e21943bcd520168fa9d57290 (patch) | |
tree | 57c91793d90a9dbfe853f5b2e9091ebf132e9606 | |
parent | 1ba323e5b698257292e769c71d125d0cd2c56d21 (diff) | |
download | busybox-w32-9cd4c76b50b8fde9e21943bcd520168fa9d57290.tar.gz busybox-w32-9cd4c76b50b8fde9e21943bcd520168fa9d57290.tar.bz2 busybox-w32-9cd4c76b50b8fde9e21943bcd520168fa9d57290.zip |
ash: fix "shift BIGNUM" and "read with no variable name" bugs.
omg. hush testsuite helps to find bugs in ash! what next?
function old new delta
static.arg_REPLY - 8 +8
readcmd 1023 1021 -2
shiftcmd 129 125 -4
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 0/2 up/down: 8/-6) Total: 2 bytes
-rw-r--r-- | shell/ash.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/shell/ash.c b/shell/ash.c index b490b69f1..f8e4e7d45 100644 --- a/shell/ash.c +++ b/shell/ash.c | |||
@@ -9549,7 +9549,7 @@ shiftcmd(int argc ATTRIBUTE_UNUSED, char **argv) | |||
9549 | if (argv[1]) | 9549 | if (argv[1]) |
9550 | n = number(argv[1]); | 9550 | n = number(argv[1]); |
9551 | if (n > shellparam.nparam) | 9551 | if (n > shellparam.nparam) |
9552 | ash_msg_and_raise_error("can't shift that many"); | 9552 | n = shellparam.nparam; |
9553 | INT_OFF; | 9553 | INT_OFF; |
9554 | shellparam.nparam -= n; | 9554 | shellparam.nparam -= n; |
9555 | for (ap1 = shellparam.p; --n >= 0; ap1++) { | 9555 | for (ap1 = shellparam.p; --n >= 0; ap1++) { |
@@ -11994,6 +11994,8 @@ typedef enum __rlimit_resource rlim_t; | |||
11994 | static int | 11994 | static int |
11995 | readcmd(int argc ATTRIBUTE_UNUSED, char **argv ATTRIBUTE_UNUSED) | 11995 | readcmd(int argc ATTRIBUTE_UNUSED, char **argv ATTRIBUTE_UNUSED) |
11996 | { | 11996 | { |
11997 | static const char *const arg_REPLY[] = { "REPLY", NULL }; | ||
11998 | |||
11997 | char **ap; | 11999 | char **ap; |
11998 | int backslash; | 12000 | int backslash; |
11999 | char c; | 12001 | char c; |
@@ -12086,7 +12088,7 @@ readcmd(int argc ATTRIBUTE_UNUSED, char **argv ATTRIBUTE_UNUSED) | |||
12086 | } | 12088 | } |
12087 | ap = argptr; | 12089 | ap = argptr; |
12088 | if (*ap == NULL) | 12090 | if (*ap == NULL) |
12089 | ash_msg_and_raise_error("arg count"); | 12091 | ap = (char**)arg_REPLY; |
12090 | ifs = bltinlookup("IFS"); | 12092 | ifs = bltinlookup("IFS"); |
12091 | if (ifs == NULL) | 12093 | if (ifs == NULL) |
12092 | ifs = defifs; | 12094 | ifs = defifs; |