summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBarton E. Schaefer <schaefer@zsh.org>2017-02-19 16:45:10 -0800
committerBarton E. Schaefer <schaefer@zsh.org>2017-02-20 13:26:49 -0800
commit9f447578f03b4c5040045a15808511e1d3c9919e (patch)
tree102fcfb87abe3fc51783b5ab522b093a7c56b579
parent4443e021f195838e84e57f4a4c868f22324437f1 (diff)
downloadzsh-9f447578f03b4c5040045a15808511e1d3c9919e.tar.gz
zsh-9f447578f03b4c5040045a15808511e1d3c9919e.zip
40576 (tweaked): entersubsh(): unblock any signals that were blocked for trap handling
Also small improvement to loop that resets trap handlers
-rw-r--r--ChangeLog6
-rw-r--r--Src/exec.c17
2 files changed, 20 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index 5f145a5a4..df1097493 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2017-02-19 Barton E. Schaefer <schaefer@zsh.org>
+
+ * 40576 (tweaked): Src/exec.c: entersubsh(): small improvement to
+ loop that resets trap handlers; unblock any signals that were
+ blocked for trap handling
+
2017-02-19 Oliver Kiddle <opk@zsh.org>
* 40569: Completion/Unix/Command/_gphoto2: update to gphoto2 2.5.11
diff --git a/Src/exec.c b/Src/exec.c
index 8f4969f52..83d1513d0 100644
--- a/Src/exec.c
+++ b/Src/exec.c
@@ -975,9 +975,8 @@ entersubsh(int flags)
int sig, monitor, job_control_ok;
if (!(flags & ESUB_KEEPTRAP))
- for (sig = 0; sig < VSIGCOUNT; sig++)
- if (!(sigtrapped[sig] & ZSIG_FUNC) &&
- sig != SIGDEBUG && sig != SIGZERR)
+ for (sig = 0; sig < SIGCOUNT; sig++)
+ if (!(sigtrapped[sig] & ZSIG_FUNC))
unsettrap(sig);
monitor = isset(MONITOR);
job_control_ok = monitor && (flags & ESUB_JOB_CONTROL) && isset(POSIXJOBS);
@@ -1068,6 +1067,18 @@ entersubsh(int flags)
}
if (!(sigtrapped[SIGQUIT] & ZSIG_IGNORED))
signal_default(SIGQUIT);
+ /*
+ * sigtrapped[sig] == ZSIG_IGNORED for signals that remain ignored,
+ * but other trapped signals are temporarily blocked when intrap,
+ * and must be unblocked before continuing into the subshell. This
+ * is orthogonal to what the default handler for the signal may be.
+ *
+ * Start loop at 1 because 0 is SIGEXIT
+ */
+ if (intrap)
+ for (sig = 1; sig < SIGCOUNT; sig++)
+ if (sigtrapped[sig] && sigtrapped[sig] != ZSIG_IGNORED)
+ signal_unblock(signal_mask(sig));
if (!job_control_ok)
opts[MONITOR] = 0;
opts[USEZLE] = 0;