about summary refs log tree commit diff
path: root/Src/exec.c
diff options
context:
space:
mode:
authorPeter Stephenson <pws@zsh.org>2015-07-09 14:58:10 +0100
committerPeter Stephenson <pws@zsh.org>2015-07-09 14:59:20 +0100
commit3af55c858f12fe72eebd6addca89bf6395cae826 (patch)
tree4bc95951b8f0785a62f94797bcafa7001b38c51c /Src/exec.c
parente402747dd6450cafaf1ca6c01671a5adf1595d02 (diff)
downloadzsh-3af55c858f12fe72eebd6addca89bf6395cae826.tar.gz
zsh-3af55c858f12fe72eebd6addca89bf6395cae826.tar.xz
zsh-3af55c858f12fe72eebd6addca89bf6395cae826.zip
35751: Fix ERR_RETURN and ERR_EXIT in "else"
Diffstat (limited to 'Src/exec.c')
-rw-r--r--Src/exec.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/Src/exec.c b/Src/exec.c
index 960601f29..4eee82bf1 100644
--- a/Src/exec.c
+++ b/Src/exec.c
@@ -1351,7 +1351,13 @@ execlist(Estate state, int dont_change_job, int exiting)
 	state->pc--;
 sublist_done:
 
-	noerrexit = oldnoerrexit;
+	/*
+	 * See hairy code near the end of execif() for the
+	 * following.  "noerrexit == 2" only applies until
+	 * we hit execcmd on the way down.  We're now
+	 * on the way back up, so don't restore it.
+	 */
+	noerrexit = (oldnoerrexit == 2) ? 0 : oldnoerrexit;
 
 	if (sigtrapped[SIGDEBUG] && !isset(DEBUGBEFORECMD) && !donedebug) {
 	    /*