about summary refs log tree commit diff
path: root/Src/exec.c
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2009-07-11 16:42:53 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2009-07-11 16:42:53 +0000
commitbdfebe3e3262eaaf83e89c9356c7c46a21181a6a (patch)
tree87027d549b390d53ab682c872c83b93ce8f98250 /Src/exec.c
parenta8fb2bbc3d580ebff421a02b9499be6a8a20b055 (diff)
downloadzsh-bdfebe3e3262eaaf83e89c9356c7c46a21181a6a.tar.gz
zsh-bdfebe3e3262eaaf83e89c9356c7c46a21181a6a.tar.xz
zsh-bdfebe3e3262eaaf83e89c9356c7c46a21181a6a.zip
27129: fix status at start of function, command subst, etc.
Diffstat (limited to 'Src/exec.c')
-rw-r--r--Src/exec.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/Src/exec.c b/Src/exec.c
index 0788ecbb9..67d48b1ce 100644
--- a/Src/exec.c
+++ b/Src/exec.c
@@ -1056,6 +1056,10 @@ execlist(Estate state, int dont_change_job, int exiting)
     /* Loop over all sets of comands separated by newline, *
      * semi-colon or ampersand (`sublists').               */
     code = *state->pc++;
+    if (wc_code(code) != WC_LIST) {
+	/* Empty list; this returns status zero. */
+	lastval = 0;
+    }
     while (wc_code(code) == WC_LIST && !breaks && !retflag && !errflag) {
 	int donedebug;
 
@@ -3513,7 +3517,6 @@ getoutput(char *cmd, int qt)
 	return retval;
     }
     /* pid == 0 */
-    lastval = 0;		/* status of empty list is zero */
     child_unblock();
     zclose(pipes[0]);
     redup(pipes[1], 1);
@@ -4261,7 +4264,6 @@ doshfunc(Shfunc shfunc, LinkList doshargs, int noreturnval)
     if (trap_state == TRAP_STATE_PRIMED)
 	trap_return--;
     oldlastval = lastval;
-    lastval = 0;		/* status of empty function is zero */
     oldnumpipestats = numpipestats;
     if (noreturnval) {
 	/*