mirror of
https://github.com/sheumann/hush.git
synced 2024-10-27 07:28:31 +00:00
ash: do not let EXIT trap to fire in trap
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
parent
7188540257
commit
0800e3af75
@ -4525,7 +4525,7 @@ clear_traps(void)
|
|||||||
INT_OFF;
|
INT_OFF;
|
||||||
free(*tp);
|
free(*tp);
|
||||||
*tp = NULL;
|
*tp = NULL;
|
||||||
if (tp != &trap[0])
|
if ((tp - trap) != 0)
|
||||||
setsignal(tp - trap);
|
setsignal(tp - trap);
|
||||||
INT_ON;
|
INT_ON;
|
||||||
}
|
}
|
||||||
@ -4596,6 +4596,8 @@ forkchild(struct job *jp, union node *n, int mode)
|
|||||||
*
|
*
|
||||||
* Our solution: ONLY bare $(trap) or `trap` is special.
|
* Our solution: ONLY bare $(trap) or `trap` is special.
|
||||||
*/
|
*/
|
||||||
|
free(trap[0]); /* Prevent EXIT trap from firing in `trap` */
|
||||||
|
trap[0] = NULL;
|
||||||
} else {
|
} else {
|
||||||
clear_traps();
|
clear_traps();
|
||||||
}
|
}
|
||||||
@ -13023,6 +13025,7 @@ exitshell(void)
|
|||||||
if (p) {
|
if (p) {
|
||||||
trap[0] = NULL;
|
trap[0] = NULL;
|
||||||
evalstring(p, 0);
|
evalstring(p, 0);
|
||||||
|
free(p);
|
||||||
}
|
}
|
||||||
flush_stdout_stderr();
|
flush_stdout_stderr();
|
||||||
out:
|
out:
|
||||||
|
Loading…
Reference in New Issue
Block a user