diff options
author | Jilles Tjoelker <jilles@FreeBSD.org> | 2009-11-21 20:44:34 +0000 |
---|---|---|
committer | Jilles Tjoelker <jilles@FreeBSD.org> | 2009-11-21 20:44:34 +0000 |
commit | e3c2cd723730b176c51271edcbddf175425eeebb (patch) | |
tree | 56e8951b61d88c5f217bc12e6c6978dd04ba02a0 /bin | |
parent | 80d5dd5fdbe8770363207af414851d8919d5f681 (diff) | |
download | src-e3c2cd723730b176c51271edcbddf175425eeebb.tar.gz src-e3c2cd723730b176c51271edcbddf175425eeebb.zip |
trap: do not consider a bad signal name a fatal error.
POSIX explicitly prescribes this.
Continue processing any other signals and return status 1.
Notes
Notes:
svn path=/head/; revision=199641
Diffstat (limited to 'bin')
-rw-r--r-- | bin/sh/trap.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/bin/sh/trap.c b/bin/sh/trap.c index 48aa264ffbba..3a6803b9d90f 100644 --- a/bin/sh/trap.c +++ b/bin/sh/trap.c @@ -149,6 +149,7 @@ trapcmd(int argc, char **argv) { char *action; int signo; + int errors = 0; if (argc <= 1) { for (signo = 0 ; signo < sys_nsig ; signo++) { @@ -183,8 +184,10 @@ trapcmd(int argc, char **argv) } } while (*argv) { - if ((signo = sigstring_to_signum(*argv)) == -1) - error("bad signal %s", *argv); + if ((signo = sigstring_to_signum(*argv)) == -1) { + out2fmt_flush("trap: bad signal %s\n", *argv); + errors = 1; + } INTOFF; if (action) action = savestr(action); @@ -196,7 +199,7 @@ trapcmd(int argc, char **argv) INTON; argv++; } - return 0; + return errors; } |