mirror of
https://git.FreeBSD.org/src.git
synced 2024-10-20 02:38:43 +00:00
sh: Fix exit status if return is used within a loop condition.
This commit is contained in:
parent
011d162dd3
commit
8f2dc7de67
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=212475
@ -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) {
|
||||
|
3
tools/regression/bin/sh/builtins/return6.4
Normal file
3
tools/regression/bin/sh/builtins/return6.4
Normal file
@ -0,0 +1,3 @@
|
||||
# $FreeBSD$
|
||||
|
||||
while return 4; do exit 3; done
|
6
tools/regression/bin/sh/builtins/return7.4
Normal file
6
tools/regression/bin/sh/builtins/return7.4
Normal file
@ -0,0 +1,6 @@
|
||||
# $FreeBSD$
|
||||
|
||||
f() {
|
||||
while return 4; do exit 3; done
|
||||
}
|
||||
f
|
Loading…
Reference in New Issue
Block a user