mirror of
git://git.code.sf.net/p/zsh/code
synced 2025-10-27 16:50:58 +01:00
22983: exit could loop for ever
This commit is contained in:
parent
96f525f468
commit
aa2ae64dff
3 changed files with 23 additions and 0 deletions
|
|
@ -4391,6 +4391,10 @@ zexit(int val, int from_where)
|
|||
{
|
||||
static int in_exit;
|
||||
|
||||
/* Don't do anything recursively: see below */
|
||||
if (in_exit == -1)
|
||||
return;
|
||||
|
||||
if (isset(MONITOR) && !stopmsg && from_where != 1) {
|
||||
scanjobs(); /* check if jobs need printing */
|
||||
if (isset(CHECKJOBS))
|
||||
|
|
@ -4400,9 +4404,16 @@ zexit(int val, int from_where)
|
|||
return;
|
||||
}
|
||||
}
|
||||
/* Positive in_exit means we have been here before */
|
||||
if (from_where == 2 || (in_exit++ && from_where))
|
||||
return;
|
||||
|
||||
/*
|
||||
* We're now committed to exiting. Set in_exit to -1 to
|
||||
* indicate we shouldn't do any recursive processing.
|
||||
*/
|
||||
in_exit = -1;
|
||||
|
||||
if (isset(MONITOR)) {
|
||||
/* send SIGHUP to any jobs left running */
|
||||
killrunjobs(from_where == 1);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue