From 17fb014dc7984902a6697c6412b0cca55300542b Mon Sep 17 00:00:00 2001 From: Peter Stephenson Date: Mon, 7 Mar 2016 09:42:21 +0000 Subject: 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. --- Src/signals.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'Src/signals.c') 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; } -- cgit 1.4.1