mirror of
https://github.com/sheumann/hush.git
synced 2024-08-20 19:29:02 +00:00
msh: fix "while...continue" bug 3884.
This commit is contained in:
parent
2b68c8f744
commit
7ae1cc16b4
@ -2573,6 +2573,10 @@ static int execute(struct op *t, int *pin, int *pout, int no_fork)
|
||||
while (setjmp(bc.brkpt))
|
||||
if (isbreak)
|
||||
goto broken;
|
||||
/* Restore areanum value. It may be incremented by execute()
|
||||
* below, and then "continue" may jump back to setjmp above */
|
||||
areanum = a + 1;
|
||||
freearea(areanum + 1);
|
||||
brkset(&bc);
|
||||
for (t1 = t->left; i-- && *wp != NULL;) {
|
||||
setval(vp, *wp++);
|
||||
@ -2586,6 +2590,10 @@ static int execute(struct op *t, int *pin, int *pout, int no_fork)
|
||||
while (setjmp(bc.brkpt))
|
||||
if (isbreak)
|
||||
goto broken;
|
||||
/* Restore areanum value. It may be incremented by execute()
|
||||
* below, and then "continue" may jump back to setjmp above */
|
||||
areanum = a + 1;
|
||||
freearea(areanum + 1);
|
||||
brkset(&bc);
|
||||
t1 = t->left;
|
||||
while ((execute(t1, pin, pout, /* no_fork: */ 0) == 0) == (t->op_type == TWHILE))
|
||||
|
1
shell/msh_test/msh-execution/many_continues.right
Normal file
1
shell/msh_test/msh-execution/many_continues.right
Normal file
@ -0,0 +1 @@
|
||||
OK
|
15
shell/msh_test/msh-execution/many_continues.tests
Executable file
15
shell/msh_test/msh-execution/many_continues.tests
Executable file
@ -0,0 +1,15 @@
|
||||
if test $# = 0; then
|
||||
# Child will kill us in 1 second
|
||||
"$THIS_SH" "$0" $$ &
|
||||
|
||||
# Loop many, many times
|
||||
trap 'echo OK; exit 0' 15
|
||||
while true; do
|
||||
continue
|
||||
done
|
||||
echo BAD
|
||||
exit 1
|
||||
fi
|
||||
|
||||
sleep 1
|
||||
kill $1
|
Loading…
Reference in New Issue
Block a user