summaryrefslogtreecommitdiff
path: root/shell/ash.c
diff options
context:
space:
mode:
Diffstat (limited to 'shell/ash.c')
-rw-r--r--shell/ash.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/shell/ash.c b/shell/ash.c
index e285130..0cfa4fc 100644
--- a/shell/ash.c
+++ b/shell/ash.c
@@ -12281,7 +12281,7 @@ trapcmd(int argc UNUSED_PARAM, char **argv UNUSED_PARAM)
{
char *action;
char **ap;
- int signo;
+ int signo, exitcode;
nextopt(nullstr);
ap = argptr;
@@ -12314,10 +12314,15 @@ trapcmd(int argc UNUSED_PARAM, char **argv UNUSED_PARAM)
action = NULL;
if (ap[1])
action = *ap++;
+ exitcode = 0;
while (*ap) {
signo = get_signum(*ap);
- if (signo < 0)
- ash_msg_and_raise_error("%s: bad trap", *ap);
+ if (signo < 0) {
+ /* Mimic bash message exactly */
+ ash_msg("%s: invalid signal specification", *ap);
+ exitcode = 1;
+ goto next;
+ }
INT_OFF;
if (action) {
if (LONE_DASH(action))
@@ -12330,9 +12335,10 @@ trapcmd(int argc UNUSED_PARAM, char **argv UNUSED_PARAM)
if (signo != 0)
setsignal(signo);
INT_ON;
+ next:
ap++;
}
- return 0;
+ return exitcode;
}