summaryrefslogtreecommitdiffhomepage
path: root/shell/hush.c
diff options
context:
space:
mode:
Diffstat (limited to 'shell/hush.c')
-rw-r--r--shell/hush.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/shell/hush.c b/shell/hush.c
index c3a4afb5a..c7971b0ce 100644
--- a/shell/hush.c
+++ b/shell/hush.c
@@ -7498,7 +7498,10 @@ static int run_list(struct pipe *pi)
#endif
#if ENABLE_HUSH_LOOPS
/* Beware of "while false; true; do ..."! */
- if (pi->next && pi->next->res_word == RES_DO) {
+ if (pi->next
+ && (pi->next->res_word == RES_DO || pi->next->res_word == RES_DONE)
+ /* (the second check above is needed for "while ...; do \n done" case) */
+ ) {
if (rword == RES_WHILE) {
if (rcode) {
/* "while false; do...done" - exitcode 0 */