diff options
author | Bart Schaefer <barts@users.sourceforge.net> | 2000-04-29 06:33:48 +0000 |
---|---|---|
committer | Bart Schaefer <barts@users.sourceforge.net> | 2000-04-29 06:33:48 +0000 |
commit | 84963428416ba7cd8518d82b1899178178dfc1b4 (patch) | |
tree | 9f1d9e386bdb244601548e75031c707a5bc38fdf /Src/signals.c | |
parent | b7e5949279a4c5f08a8c1460345c05cdb193f5eb (diff) | |
download | zsh-84963428416ba7cd8518d82b1899178178dfc1b4.tar.gz zsh-84963428416ba7cd8518d82b1899178178dfc1b4.tar.xz zsh-84963428416ba7cd8518d82b1899178178dfc1b4.zip |
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().
Diffstat (limited to 'Src/signals.c')
-rw-r--r-- | Src/signals.c | 22 |
1 files changed, 17 insertions, 5 deletions
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(); /* @@ -726,11 +727,22 @@ 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; } /**/ |