1
0
mirror of git://git.code.sf.net/p/zsh/code synced 2024-11-19 13:33:52 +01:00

11901: two more trap saving bugs

This commit is contained in:
Peter Stephenson 2000-06-14 15:14:49 +00:00
parent ae8c986107
commit 4611530c45
2 changed files with 9 additions and 1 deletions

@ -1,5 +1,9 @@
2000-06-14 Peter Stephenson <pws@cambridgesiliconradio.com>
* 11901: Src/signals.c: not one but two more bugs in trap
saving: sigfuncs wasn't reset for function signals, and dosavetrap()
didn't check sigtrapped before assuming sigfuncs was valid.
* 11895: Src/signals.c: exit traps weren't cleared from the
list properly, resulting in memory management problems.

@ -671,8 +671,11 @@ dosavetrap(int sig, int level)
newshf->funcdef = dupeprog(shf->funcdef, 0);
}
st->list = newshf;
} else {
} else if (sigtrapped[sig]) {
st->list = sigfuncs[sig] ? dupeprog(sigfuncs[sig], 0) : NULL;
} else {
DPUTS(sigfuncs[sig], "BUG: sigfuncs not null for untrapped signal");
st->list = NULL;
}
if (!savetraps)
savetraps = znewlinklist();
@ -789,6 +792,7 @@ removetrap(int sig)
* As in dosavetrap(), don't call removeshfuncnode() because
* that calls back into unsettrap();
*/
sigfuncs[sig] = NULL;
return removehashnode(shfunctab, func);
} else if (sigfuncs[sig]) {
freeeprog(sigfuncs[sig]);