summaryrefslogtreecommitdiff
path: root/Src/signals.c
diff options
context:
space:
mode:
authorAxel Beckert <abe@deuxchevaux.org>2015-08-22 01:55:58 +0200
committerAxel Beckert <abe@deuxchevaux.org>2015-08-22 01:55:58 +0200
commit02f6e25bfcd5feb9a093377dda0dd549cdf5c309 (patch)
tree9a25e61122b3fa0d0a1ff68b5ef05c775ff78b1e /Src/signals.c
parente04a19735ffc8523b93b33074f685ad4e2c92e0c (diff)
parent881474edcb223ac22a08d81a824809c33ca3a9c9 (diff)
downloadzsh-02f6e25bfcd5feb9a093377dda0dd549cdf5c309.tar.gz
zsh-02f6e25bfcd5feb9a093377dda0dd549cdf5c309.zip
Merge tag 'zsh-5.0.8-test-2' into debian
Diffstat (limited to 'Src/signals.c')
-rw-r--r--Src/signals.c26
1 files changed, 22 insertions, 4 deletions
diff --git a/Src/signals.c b/Src/signals.c
index 3950ad1a2..f45c1860c 100644
--- a/Src/signals.c
+++ b/Src/signals.c
@@ -487,6 +487,12 @@ wait_for_processes(void)
break;
}
+ /* This is necessary to be sure queueing_enabled > 0 when
+ * we enter printjob() from update_job(), so that we don't
+ * decrement to zero in should_report_time() and improperly
+ * run other handlers in the middle of processing this one */
+ queue_signals();
+
/*
* Find the process and job containing this pid and
* update it.
@@ -528,8 +534,16 @@ wait_for_processes(void)
* and is not equal to the current foreground job.
*/
if (jn && !(jn->stat & (STAT_CURSH|STAT_BUILTIN)) &&
- jn - jobtab != thisjob)
- addbgstatus(pid, (int)lastval2);
+ jn - jobtab != thisjob) {
+ int val = (WIFSIGNALED(status) ?
+ 0200 | WTERMSIG(status) :
+ (WIFSTOPPED(status) ?
+ 0200 | WEXITSTATUS(status) :
+ WEXITSTATUS(status)));
+ addbgstatus(pid, val);
+ }
+
+ unqueue_signals();
}
}
@@ -1207,6 +1221,8 @@ dotrapargs(int sig, int *sigtr, void *sigfn)
}
}
+ queue_signals(); /* Any time we manage memory or global state */
+
intrap++;
*sigtr |= ZSIG_IGNORED;
@@ -1244,7 +1260,7 @@ dotrapargs(int sig, int *sigtr, void *sigfn)
sfcontext = SFC_SIGNAL;
incompfunc = 0;
- doshfunc((Shfunc)sigfn, args, 1);
+ doshfunc((Shfunc)sigfn, args, 1); /* manages signal queueing */
sfcontext = osc;
incompfunc= old_incompfunc;
freelinklist(args, (FreeFunc) NULL);
@@ -1254,7 +1270,7 @@ dotrapargs(int sig, int *sigtr, void *sigfn)
trap_state = TRAP_STATE_PRIMED;
trapisfunc = isfunc = 0;
- execode((Eprog)sigfn, 1, 0, "trap");
+ execode((Eprog)sigfn, 1, 0, "trap"); /* manages signal queueing */
}
runhookdef(AFTERTRAPHOOK, NULL);
@@ -1321,6 +1337,8 @@ dotrapargs(int sig, int *sigtr, void *sigfn)
if (*sigtr != ZSIG_IGNORED)
*sigtr &= ~ZSIG_IGNORED;
intrap--;
+
+ unqueue_signals();
}
/* Standard call to execute a trap for a given signal. */