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

PATCH: WC_ENDs



Just found a bug report in one of the Debian lists. Running a function 
like:

  mycd() { builtin cd "$@" && echo "$PWD" }

where the cd failed caused a core dump. This makes all functions have
their WC_END code at the end to avoid that.

Bye
 Sven

diff -ru ../z.old/Src/parse.c Src/parse.c
--- ../z.old/Src/parse.c	Fri Feb 25 14:16:53 2000
+++ Src/parse.c	Fri Feb 25 16:10:06 2000
@@ -1327,7 +1327,7 @@
 
     if (tok == INBRACE) {
 	yylex();
-	par_save_list(&c);
+	par_list(&c);
 	if (tok != OUTBRACE) {
 	    lineno += oldlineno;
 	    ecsoffs = sbeg;
@@ -1343,8 +1343,9 @@
 	ecnpats = onp;
 	YYERRORV(oecused);
     } else
-	par_save_list1(&c);
+	par_list1(&c);
 
+    ecadd(WCB_END());
     ecbuf[p + num + 2] = ecused - num - p;
     ecbuf[p + num + 3] = ecnpats;
     ecbuf[p + 1] = num;
@@ -1507,7 +1508,7 @@
 		int c = 0;
 
 		yylex();
-		par_save_list(&c);
+		par_list(&c);
 		if (tok != OUTBRACE) {
 		    cmdpop();
 		    lineno += oldlineno;
@@ -1530,6 +1531,7 @@
 	    }
 	    cmdpop();
 
+	    ecadd(WCB_END());
 	    ecbuf[p + argc + 2] = ecused - argc - p;
 	    ecbuf[p + argc + 3] = ecnpats;
 

--
Sven Wischnowsky                         wischnow@xxxxxxxxxxxxxxxxxxxxxxx



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