about summary refs log tree commit diff
path: root/Src
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 /Src
parent2c56c7e5e809476fc6511a9e634d2a977593ef9e (diff)
downloadzsh-ff365909105cc360f4d1384bd7ad56cdd97fec31.tar.gz
zsh-ff365909105cc360f4d1384bd7ad56cdd97fec31.tar.xz
zsh-ff365909105cc360f4d1384bd7ad56cdd97fec31.zip
39844: fix "while" condition as per 39839 (commit 2c56c7e5)
Diffstat (limited to 'Src')
-rw-r--r--Src/loop.c7
1 files changed, 3 insertions, 4 deletions
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. */