summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog1
-rw-r--r--src/eval.c3
2 files changed, 3 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 1d88e13..297b81a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -3,6 +3,7 @@
 	* Exit without arguments in a trap should use status outside traps.
 	* Do not allow break to break across function calls.
 	* Move common skipcount logic into skiploop.
+	* Allow return in loop conditional to set exit status.
 
 2014-10-03  Herbert Xu <herbert@gondor.apana.org.au>
 
diff --git a/src/eval.c b/src/eval.c
index daccf3d..7b341f3 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -387,8 +387,9 @@ evalloop(union node *n, int flags)
 		status = exitstatus;
 		skip = skiploop();
 	} while (!(skip & ~SKIPCONT));
+	if (skip != SKIPFUNC)
+		exitstatus = status;
 	loopnest--;
-	exitstatus = status;
 }