mirror of
git://git.code.sf.net/p/zsh/code
synced 2025-07-14 17:51:28 +02:00
46060: Fix spurious actions on exit status 130 or 131.
Ensure process has taken a signal before looking for SIGINT or SIGQUIT.
This commit is contained in:
parent
1939db10af
commit
baf4fa3621
2 changed files with 12 additions and 4 deletions
|
@ -1,3 +1,8 @@
|
|||
2020-06-18 Peter Stephenson <p.stephenson@samsung.com>
|
||||
|
||||
* 46060: Src/jobs.c: Ensure process has been signalled before
|
||||
taking special action for SIGINT or SIGQUIT.
|
||||
|
||||
2020-06-17 Eric Cook <llua@gmx.com>
|
||||
|
||||
* 45982: Frederick Zhang: Completion/Unix/Command/_zfs:
|
||||
|
|
11
Src/jobs.c
11
Src/jobs.c
|
@ -442,7 +442,7 @@ update_job(Job jn)
|
|||
Process pn;
|
||||
int job;
|
||||
int val = 0, status = 0;
|
||||
int somestopped = 0, inforeground = 0;
|
||||
int somestopped = 0, inforeground = 0, signalled = 0;
|
||||
|
||||
for (pn = jn->auxprocs; pn; pn = pn->next) {
|
||||
#ifdef WIFCONTINUED
|
||||
|
@ -464,12 +464,15 @@ update_job(Job jn)
|
|||
return; /* so no need to update job table entry */
|
||||
if (WIFSTOPPED(pn->status)) /* some processes are stopped */
|
||||
somestopped = 1; /* so job is not done, but entry needs updating */
|
||||
if (!pn->next) /* last job in pipeline determines exit status */
|
||||
if (!pn->next) {
|
||||
/* last job in pipeline determines exit status */
|
||||
val = (WIFSIGNALED(pn->status) ?
|
||||
0200 | WTERMSIG(pn->status) :
|
||||
(WIFSTOPPED(pn->status) ?
|
||||
0200 | WEXITSTATUS(pn->status) :
|
||||
WEXITSTATUS(pn->status)));
|
||||
signalled = WIFSIGNALED(pn->status);
|
||||
}
|
||||
if (pn->pid == jn->gleader) /* if this process is process group leader */
|
||||
status = pn->status;
|
||||
}
|
||||
|
@ -564,7 +567,7 @@ update_job(Job jn)
|
|||
}
|
||||
/* If we have `foo|while true; (( x++ )); done', and hit
|
||||
* ^C, we have to stop the loop, too. */
|
||||
if ((val & 0200) && inforeground == 1 &&
|
||||
if (signalled && inforeground == 1 &&
|
||||
((val & ~0200) == SIGINT || (val & ~0200) == SIGQUIT)) {
|
||||
if (!errbrk_saved) {
|
||||
errbrk_saved = 1;
|
||||
|
@ -581,7 +584,7 @@ update_job(Job jn)
|
|||
adjustwinsize(0);
|
||||
}
|
||||
}
|
||||
} else if (list_pipe && (val & 0200) && inforeground == 1 &&
|
||||
} else if (list_pipe && signalled && inforeground == 1 &&
|
||||
((val & ~0200) == SIGINT || (val & ~0200) == SIGQUIT)) {
|
||||
if (!errbrk_saved) {
|
||||
errbrk_saved = 1;
|
||||
|
|
Loading…
Reference in a new issue