sh: Fix exit status if return is used within a loop condition.

This commit is contained in:
Jilles Tjoelker 2010-09-11 15:07:40 +00:00
parent 011d162dd3
commit 8f2dc7de67
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=212475
3 changed files with 11 additions and 0 deletions

View File

@ -305,6 +305,8 @@ skipping: if (evalskip == SKIPCONT && --skipcount <= 0) {
}
if (evalskip == SKIPBREAK && --skipcount <= 0)
evalskip = 0;
if (evalskip == SKIPFUNC || evalskip == SKIPFILE)
status = exitstatus;
break;
}
if (n->type == NWHILE) {

View File

@ -0,0 +1,3 @@
# $FreeBSD$
while return 4; do exit 3; done

View File

@ -0,0 +1,6 @@
# $FreeBSD$
f() {
while return 4; do exit 3; done
}
f