diff options
author | Peter Stephenson <pws@users.sourceforge.net> | 2004-11-23 16:29:50 +0000 |
---|---|---|
committer | Peter Stephenson <pws@users.sourceforge.net> | 2004-11-23 16:29:50 +0000 |
commit | 138c5df2bb1b16f712374ec1bd8024a143856793 (patch) | |
tree | 1e2fff8a0bbaed1e1de4cc96d037caa6e747777b /Src | |
parent | 5141e68daa20caa8523361d5dff63e9384c30191 (diff) | |
download | zsh-138c5df2bb1b16f712374ec1bd8024a143856793.tar.gz zsh-138c5df2bb1b16f712374ec1bd8024a143856793.tar.xz zsh-138c5df2bb1b16f712374ec1bd8024a143856793.zip |
20576: fix core dump on TRAPEXIT
Diffstat (limited to 'Src')
-rw-r--r-- | Src/signals.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/Src/signals.c b/Src/signals.c index 9959d3c31..785ff159e 100644 --- a/Src/signals.c +++ b/Src/signals.c @@ -1010,7 +1010,19 @@ dotrapargs(int sig, int *sigtr, void *sigfn) HashNode hn = gettrapnode(sig, 0); args = znewlinklist(); - name = ztrdup(hn->nam); + /* + * In case of multiple names, try to get + * a hint of the name in use from the function table. + * In special cases, e.g. EXIT traps, the function + * has already been removed. Then it's OK to + * use the standard name. + */ + if (hn) { + name = ztrdup(hn->nam); + } else { + name = (char *) zalloc(5 + strlen(sigs[sig])); + sprintf(name, "TRAP%s", sigs[sig]); + } zaddlinknode(args, name); sprintf(num, "%d", sig); zaddlinknode(args, num); |