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-10 22:10:25 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2009-07-10 22:10:25 +0000
commit4db28c55b64ec25cd258f87a0d60b0544fe50059 (patch)
tree7e6c98c9aeae22faf5bc1bb06ff776da5edbf795 /Src/exec.c
parentb4c2ea2cece1adeaa915f6c12f310f2268a58751 (diff)
downloadzsh-4db28c55b64ec25cd258f87a0d60b0544fe50059.tar.gz
zsh-4db28c55b64ec25cd258f87a0d60b0544fe50059.tar.xz
zsh-4db28c55b64ec25cd258f87a0d60b0544fe50059.zip
27126: a few more contexts where executing empty lists gives status zero
Diffstat (limited to 'Src/exec.c')
-rw-r--r--Src/exec.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/Src/exec.c b/Src/exec.c
index 852d75bb5..0788ecbb9 100644
--- a/Src/exec.c
+++ b/Src/exec.c
@@ -1372,7 +1372,8 @@ execpline(Estate state, wordcode slcode, int how, int last1)
 	else
 	    spawnjob();
 	child_unblock();
-	return 0;
+	/* Executing background code resets shell status */
+	return lastval = 0;
     } else {
 	if (newjob != lastwj) {
 	    Job jn = jobtab + newjob;
@@ -3512,6 +3513,7 @@ 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);
@@ -4259,6 +4261,7 @@ 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) {
 	/*