From 84963428416ba7cd8518d82b1899178178dfc1b4 Mon Sep 17 00:00:00 2001 From: Bart Schaefer Date: Sat, 29 Apr 2000 06:33:48 +0000 Subject: 11015: `unfunction TRAPxxx' now works with localtraps in effect. I'm not very happy with having to play with `noerrs' but I don't see any other way to silence the warning from bin_unhash(). --- Src/signals.c | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) (limited to 'Src/signals.c') diff --git a/Src/signals.c b/Src/signals.c index 0518b1927..891ea1143 100644 --- a/Src/signals.c +++ b/Src/signals.c @@ -670,6 +670,7 @@ dosavetrap(int sig, int level) st->list = sigfuncs[sig]; sigfuncs[sig] = NULL; } + noerrs = !!st->list; if (!savetraps) savetraps = znewlinklist(); /* @@ -725,12 +726,23 @@ settrap(int sig, Eprog l) /**/ void unsettrap(int sig) +{ + int ne = noerrs; + HashNode hn = removetrap(sig); + noerrs = ne; + if (hn) + shfunctab->freenode(hn); +} + +/**/ +HashNode +removetrap(int sig) { int trapped; if (sig == -1 || (jobbing && (sig == SIGTTOU || sig == SIGTSTP || sig == SIGTTIN))) - return; + return NULL; trapped = sigtrapped[sig]; /* @@ -743,7 +755,7 @@ unsettrap(int sig) dosavetrap(sig, locallevel); if (!trapped) - return; + return NULL; sigtrapped[sig] = 0; if (sig == SIGINT && interact) { @@ -769,19 +781,19 @@ unsettrap(int sig) */ if (trapped & ZSIG_FUNC) { char func[20]; - HashNode hn; sprintf(func, "TRAP%s", sigs[sig]); /* * As in dosavetrap(), don't call removeshfuncnode() because * that calls back into unsettrap(); */ - if ((hn = removehashnode(shfunctab, func))) - shfunctab->freenode(hn); + return removehashnode(shfunctab, func); } else if (sigfuncs[sig]) { freeeprog(sigfuncs[sig]); sigfuncs[sig] = NULL; } + + return NULL; } /**/ -- cgit 1.4.1