diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2010-12-21 05:31:47 +0100 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2010-12-21 05:31:47 +0100 |
commit | 2a1571bfa003233470140a17be4ae4f0239f5a24 (patch) | |
tree | 57d2118dfaf31f19a0c5ad0acd8eb89a1c2cbfe7 /shell | |
parent | 5ab20641d687bfe4d86d255f8c369af54b6026e7 (diff) | |
download | busybox-w32-1_18_1.tar.gz busybox-w32-1_18_1.tar.bz2 busybox-w32-1_18_1.zip |
apply post-1.18.0 patches, bump version to 1.18.11_18_1
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'shell')
-rw-r--r-- | shell/hush.c | 45 |
1 files changed, 24 insertions, 21 deletions
diff --git a/shell/hush.c b/shell/hush.c index 26a50744e..fa7e4f563 100644 --- a/shell/hush.c +++ b/shell/hush.c | |||
@@ -6995,27 +6995,30 @@ static int run_list(struct pipe *pi) | |||
6995 | 6995 | ||
6996 | #if ENABLE_HUSH_LOOPS | 6996 | #if ENABLE_HUSH_LOOPS |
6997 | /* Check syntax for "for" */ | 6997 | /* Check syntax for "for" */ |
6998 | for (struct pipe *cpipe = pi; cpipe; cpipe = cpipe->next) { | 6998 | { |
6999 | if (cpipe->res_word != RES_FOR && cpipe->res_word != RES_IN) | 6999 | struct pipe *cpipe; |
7000 | continue; | 7000 | for (cpipe = pi; cpipe; cpipe = cpipe->next) { |
7001 | /* current word is FOR or IN (BOLD in comments below) */ | 7001 | if (cpipe->res_word != RES_FOR && cpipe->res_word != RES_IN) |
7002 | if (cpipe->next == NULL) { | 7002 | continue; |
7003 | syntax_error("malformed for"); | 7003 | /* current word is FOR or IN (BOLD in comments below) */ |
7004 | debug_leave(); | 7004 | if (cpipe->next == NULL) { |
7005 | debug_printf_exec("run_list lvl %d return 1\n", G.run_list_level); | 7005 | syntax_error("malformed for"); |
7006 | return 1; | 7006 | debug_leave(); |
7007 | } | 7007 | debug_printf_exec("run_list lvl %d return 1\n", G.run_list_level); |
7008 | /* "FOR v; do ..." and "for v IN a b; do..." are ok */ | 7008 | return 1; |
7009 | if (cpipe->next->res_word == RES_DO) | 7009 | } |
7010 | continue; | 7010 | /* "FOR v; do ..." and "for v IN a b; do..." are ok */ |
7011 | /* next word is not "do". It must be "in" then ("FOR v in ...") */ | 7011 | if (cpipe->next->res_word == RES_DO) |
7012 | if (cpipe->res_word == RES_IN /* "for v IN a b; not_do..."? */ | 7012 | continue; |
7013 | || cpipe->next->res_word != RES_IN /* FOR v not_do_and_not_in..."? */ | 7013 | /* next word is not "do". It must be "in" then ("FOR v in ...") */ |
7014 | ) { | 7014 | if (cpipe->res_word == RES_IN /* "for v IN a b; not_do..."? */ |
7015 | syntax_error("malformed for"); | 7015 | || cpipe->next->res_word != RES_IN /* FOR v not_do_and_not_in..."? */ |
7016 | debug_leave(); | 7016 | ) { |
7017 | debug_printf_exec("run_list lvl %d return 1\n", G.run_list_level); | 7017 | syntax_error("malformed for"); |
7018 | return 1; | 7018 | debug_leave(); |
7019 | debug_printf_exec("run_list lvl %d return 1\n", G.run_list_level); | ||
7020 | return 1; | ||
7021 | } | ||
7019 | } | 7022 | } |
7020 | } | 7023 | } |
7021 | #endif | 7024 | #endif |