Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

PATCH: Re: trap ""



Tanaka Akira wrote:

> I found that
> 
> zsh -c 'trap "" 2; cat' 
> 
> can be exited by ^C.  Since zsh-3.1.6-dev-17, at least.
> 
> zsh-3.1.6-dev-15 or before doesn't exit and zsh-3.1.6-dev-16 dumps
> core.

The problem was that the signal code didn't correctly found out if an
eprog was empty. There is now the function empty_eprog() for this.

Bye
 Sven

Index: Src/parse.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/parse.c,v
retrieving revision 1.4
diff -u -r1.4 parse.c
--- Src/parse.c	2000/04/05 09:20:04	1.4
+++ Src/parse.c	2000/04/10 14:12:36
@@ -399,6 +399,13 @@
     return ret;
 }
 
+/**/
+mod_export int
+empty_eprog(Eprog p)
+{
+    return (!p || !p->prog || *p->prog == WCB_END());
+}
+
 /*
  * event	: ENDINPUT
  *			| SEPER
Index: Src/signals.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/signals.c,v
retrieving revision 1.1.1.27
diff -u -r1.1.1.27 signals.c
--- Src/signals.c	2000/03/14 11:12:15	1.1.1.27
+++ Src/signals.c	2000/04/10 14:12:37
@@ -696,7 +696,7 @@
     unsettrap(sig);
 
     sigfuncs[sig] = l;
-    if (!l) {
+    if (empty_eprog(l)) {
 	sigtrapped[sig] = ZSIG_IGNORED;
         if (sig && sig <= SIGCOUNT &&
 #ifdef SIGWINCH

--
Sven Wischnowsky                         wischnow@xxxxxxxxxxxxxxxxxxxxxxx



Messages sorted by: Reverse Date, Date, Thread, Author