From 4db28c55b64ec25cd258f87a0d60b0544fe50059 Mon Sep 17 00:00:00 2001 From: Peter Stephenson Date: Fri, 10 Jul 2009 22:10:25 +0000 Subject: 27126: a few more contexts where executing empty lists gives status zero --- Src/exec.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'Src/exec.c') 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) { /* -- cgit v1.2.3