diff options
Diffstat (limited to 'shell/ash.c')
-rw-r--r-- | shell/ash.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/shell/ash.c b/shell/ash.c index b4b0d5253..42e14cbc8 100644 --- a/shell/ash.c +++ b/shell/ash.c | |||
@@ -12981,13 +12981,18 @@ trapcmd(int argc UNUSED_PARAM, char **argv UNUSED_PARAM) | |||
12981 | return 0; | 12981 | return 0; |
12982 | } | 12982 | } |
12983 | 12983 | ||
12984 | /* Why the second check? | ||
12985 | * "trap NUM [sig2]..." is the same as "trap - NUM [sig2]..." | ||
12986 | * In this case, NUM is signal no, not an action. | ||
12987 | */ | ||
12984 | action = NULL; | 12988 | action = NULL; |
12985 | if (ap[1]) | 12989 | if (ap[1] && !is_number(ap[0])) |
12986 | action = *ap++; | 12990 | action = *ap++; |
12991 | |||
12987 | exitcode = 0; | 12992 | exitcode = 0; |
12988 | while (*ap) { | 12993 | while (*ap) { |
12989 | signo = get_signum(*ap); | 12994 | signo = get_signum(*ap); |
12990 | if (signo < 0 || signo >= NSIG) { | 12995 | if (signo < 0) { |
12991 | /* Mimic bash message exactly */ | 12996 | /* Mimic bash message exactly */ |
12992 | ash_msg("%s: invalid signal specification", *ap); | 12997 | ash_msg("%s: invalid signal specification", *ap); |
12993 | exitcode = 1; | 12998 | exitcode = 1; |