diff options
author | Peter Stephenson <pws@zsh.org> | 2016-03-07 09:42:21 +0000 |
---|---|---|
committer | Peter Stephenson <pws@zsh.org> | 2016-03-07 09:42:21 +0000 |
commit | 17fb014dc7984902a6697c6412b0cca55300542b (patch) | |
tree | 0fcae721ebf4ea22a2258b26712b14b74d71d4e2 /Src | |
parent | bc958ab27591f3bb717efeb95fa541ee14a2405b (diff) | |
download | zsh-17fb014dc7984902a6697c6412b0cca55300542b.tar.gz zsh-17fb014dc7984902a6697c6412b0cca55300542b.tar.xz zsh-17fb014dc7984902a6697c6412b0cca55300542b.zip |
38094: Fix POSIX EXIT traps defined in function.
These aren't local, so set the local level to 0; else they can get overridden incorrectly.
Diffstat (limited to 'Src')
-rw-r--r-- | Src/signals.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/Src/signals.c b/Src/signals.c index 1344395f7..2eefc07de 100644 --- a/Src/signals.c +++ b/Src/signals.c @@ -877,16 +877,21 @@ settrap(int sig, Eprog l, int flags) sig != SIGCHLD) install_handler(sig); } + sigtrapped[sig] |= flags; /* * Note that introducing the locallevel does not affect whether * sigtrapped[sig] is zero or not, i.e. a test without a mask * works just the same. */ - sigtrapped[sig] |= (locallevel << ZSIG_SHIFT) | flags; if (sig == SIGEXIT) { /* Make POSIX behaviour of EXIT trap sticky */ exit_trap_posix = isset(POSIXTRAPS); + /* POSIX exit traps are not local. */ + if (!exit_trap_posix) + sigtrapped[sig] |= (locallevel << ZSIG_SHIFT); } + else + sigtrapped[sig] |= (locallevel << ZSIG_SHIFT); unqueue_signals(); return 0; } |