summary refs log tree commit diff
diff options
context:
space:
mode:
authorBarton E. Schaefer <schaefer@zsh.org>2015-09-30 20:01:13 -0700
committerBarton E. Schaefer <schaefer@zsh.org>2015-09-30 20:01:13 -0700
commit2bf4f667fb41a8aba139e3ef93b1ebcd9f3e016d (patch)
treece171de2df6ec89cf94520d29afa52c110eb167f
parentd1a810b000296bac43b114af526b0787068ae3ba (diff)
downloadzsh-2bf4f667fb41a8aba139e3ef93b1ebcd9f3e016d.tar.gz
zsh-2bf4f667fb41a8aba139e3ef93b1ebcd9f3e016d.tar.xz
zsh-2bf4f667fb41a8aba139e3ef93b1ebcd9f3e016d.zip
36707: distinguish ERR_RETURN value of retflag so that execif() can ignore it in the test sublist
-rw-r--r--ChangeLog3
-rw-r--r--Src/exec.c2
-rw-r--r--Src/loop.c8
3 files changed, 10 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index 018585611..3f54075f8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -10,6 +10,9 @@
 
 2015-09-30  Barton E. Schaefer  <schaefer@zsh.org>
 
+	* 36707: Src/exec.c, Src/loop.c: distinguish ERR_RETURN value
+	of retflag so that execif() can ignore it in the test sublist
+
 	* cf. 36690: Doc/Zsh/builtins.yo: remove sentence fragment
 
 2015-09-30  Daniel Shahaf  <d.s@daniel.shahaf.name>
diff --git a/Src/exec.c b/Src/exec.c
index da808d6f1..154bbb8db 100644
--- a/Src/exec.c
+++ b/Src/exec.c
@@ -1408,7 +1408,7 @@ sublist_done:
 			exit(lastval);
 		}
 		if (errreturn) {
-		    retflag = 1;
+		    retflag = 2;
 		    breaks = loops;
 		}
 	    }
diff --git a/Src/loop.c b/Src/loop.c
index 4def9b652..7d1528efe 100644
--- a/Src/loop.c
+++ b/Src/loop.c
@@ -552,8 +552,12 @@ execif(Estate state, int do_exec)
 	    run = 1;
 	    break;
 	}
-	if (retflag)
-	    break;
+	if (retflag) {
+	    if (retflag == 2)
+		retflag = 0; /* Never ERR_RETURN here */
+	    else
+		break;
+	}
 	s = 1;
 	state->pc = next;
     }