1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-10-07 09:21:18 +02:00

21197: Fix LOCAL_TRAPS inside another trap

This commit is contained in:
Peter Stephenson 2005-04-27 09:58:42 +00:00
parent f49c66fc6a
commit 2c208c7743
3 changed files with 15 additions and 5 deletions

View file

@ -1,3 +1,8 @@
2005-04-27 Peter Stephenson <pws@csr.com>
* 21197: Src/exec.c, Src/signals.c: LOCAL_TRAPS didn't restore
a trap when modified inside another trap.
2005-04-27 Wayne Davison <wayned@users.sourceforge.net>
* unposted: Completion/Unix/Command/_rsync: Made some

View file

@ -3669,8 +3669,7 @@ doshfunc(char *name, Eprog prog, LinkList doshargs, int flags, int noreturnval)
memcpy(oldpipestats, pipestats, bytes);
}
if (!intrap)
starttrapscope();
starttrapscope();
tab = pparams;
if (!(flags & PM_UNDEFINED))
@ -3770,8 +3769,7 @@ doshfunc(char *name, Eprog prog, LinkList doshargs, int flags, int noreturnval)
opts[LOCALOPTIONS] = saveopts[LOCALOPTIONS];
}
if (!intrap)
endtrapscope();
endtrapscope();
if (trapreturn < -1)
trapreturn++;

View file

@ -888,6 +888,10 @@ removetrap(int sig)
void
starttrapscope(void)
{
/* No special SIGEXIT behaviour inside another trap. */
if (intrap)
return;
/*
* SIGEXIT needs to be restored at the current locallevel,
* so give it the next higher one. dosavetrap() is called
@ -917,8 +921,11 @@ endtrapscope(void)
/*
* Remember the exit trap, but don't run it until
* after all the other traps have been put back.
* Don't do this inside another trap.
*/
if ((exittr = sigtrapped[SIGEXIT])) {
if (intrap)
exittr = 0;
else if ((exittr = sigtrapped[SIGEXIT])) {
if (exittr & ZSIG_FUNC) {
exitfn = removehashnode(shfunctab, "TRAPEXIT");
} else {