about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog2
-rw-r--r--Src/loop.c3
2 files changed, 4 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index bcea79190..fef3a92c9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,7 @@
 2016-11-05  Barton E. Schaefer  <schaefer@zsh.org>
 
+	* 39839: Src/loop.c: fix "return" from "if" condition
+
 	* 39838: Src/builtin.c: another missing unqueue_signals()
 
 2016-11-04  Oliver Kiddle  <opk@zsh.org>
diff --git a/Src/loop.c b/Src/loop.c
index b791a898d..f65c72bf4 100644
--- a/Src/loop.c
+++ b/Src/loop.c
@@ -570,7 +570,8 @@ execif(Estate state, int do_exec)
 	cmdpop();
     } else {
 	noerrexit = olderrexit;
-	lastval = 0;
+	if (!retflag)
+	    lastval = 0;
     }
     state->pc = end;