about summary refs log tree commit diff
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2000-06-14 15:14:49 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2000-06-14 15:14:49 +0000
commit4611530c455e66de32bb28e3588924efc88608ce (patch)
tree4f3118468394d4907aa2b8bf57c5e53cfeb0df61
parentae8c986107bc092abb35fecd639e4323f8d69ec7 (diff)
downloadzsh-4611530c455e66de32bb28e3588924efc88608ce.tar.gz
zsh-4611530c455e66de32bb28e3588924efc88608ce.tar.xz
zsh-4611530c455e66de32bb28e3588924efc88608ce.zip
11901: two more trap saving bugs
-rw-r--r--ChangeLog4
-rw-r--r--Src/signals.c6
2 files changed, 9 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 9ac384183..12cf5feac 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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.
 
diff --git a/Src/signals.c b/Src/signals.c
index 543d4ab9b..7ec517b7f 100644
--- a/Src/signals.c
+++ b/Src/signals.c
@@ -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]);