summary refs log tree commit diff
diff options
context:
space:
mode:
authorBarton E. Schaefer <schaefer@zsh.org>2016-11-05 18:23:04 -0700
committerBarton E. Schaefer <schaefer@zsh.org>2016-11-05 18:23:04 -0700
commitff365909105cc360f4d1384bd7ad56cdd97fec31 (patch)
tree68d80b08344697d4eb7dd85057add16bc860f429
parent2c56c7e5e809476fc6511a9e634d2a977593ef9e (diff)
downloadzsh-ff365909105cc360f4d1384bd7ad56cdd97fec31.tar.gz
zsh-ff365909105cc360f4d1384bd7ad56cdd97fec31.tar.xz
zsh-ff365909105cc360f4d1384bd7ad56cdd97fec31.zip
39844: fix "while" condition as per 39839 (commit 2c56c7e5)
-rw-r--r--ChangeLog2
-rw-r--r--Src/loop.c7
2 files changed, 5 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index fef3a92c9..629d36a7b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,7 @@
 2016-11-05  Barton E. Schaefer  <schaefer@zsh.org>
 
+	* 39844: Src/loop.c: fix "while" condition as per 39839
+
 	* 39839: Src/loop.c: fix "return" from "if" condition
 
 	* 39838: Src/builtin.c: another missing unqueue_signals()
diff --git a/Src/loop.c b/Src/loop.c
index f65c72bf4..367c0df5c 100644
--- a/Src/loop.c
+++ b/Src/loop.c
@@ -439,13 +439,12 @@ execwhile(Estate state, UNUSED(int do_exec))
             if (!((lastval == 0) ^ isuntil)) {
                 if (breaks)
                     breaks--;
-                lastval = oldval;
+		if (!retflag)
+		    lastval = oldval;
                 break;
             }
-            if (retflag) {
-                lastval = oldval;
+            if (retflag)
                 break;
-            }
 
 	    /* In case the loop body is also a functional no-op,
 	     * make sure signal handlers recognize ^C as above. */