aboutsummaryrefslogtreecommitdiff
path: root/shell
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2010-12-18 01:34:49 +0100
committerDenys Vlasenko <vda.linux@googlemail.com>2010-12-18 01:34:49 +0100
commit0d6a4ecb30f596570585bbde29f7c9b42a60b623 (patch)
tree58419b886d755c88346b590ba297a1f38407d0f5 /shell
parenta6041860f878142e91be7889a26742e25f323c8f (diff)
downloadbusybox-w32-0d6a4ecb30f596570585bbde29f7c9b42a60b623.tar.gz
busybox-w32-0d6a4ecb30f596570585bbde29f7c9b42a60b623.tar.bz2
busybox-w32-0d6a4ecb30f596570585bbde29f7c9b42a60b623.zip
hush: fix build breakage (variable declared in for())
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'shell')
-rw-r--r--shell/hush.c45
1 files changed, 24 insertions, 21 deletions
diff --git a/shell/hush.c b/shell/hush.c
index 087636b6d..2bca9aa87 100644
--- a/shell/hush.c
+++ b/shell/hush.c
@@ -7013,27 +7013,30 @@ static int run_list(struct pipe *pi)
7013 7013
7014#if ENABLE_HUSH_LOOPS 7014#if ENABLE_HUSH_LOOPS
7015 /* Check syntax for "for" */ 7015 /* Check syntax for "for" */
7016 for (struct pipe *cpipe = pi; cpipe; cpipe = cpipe->next) { 7016 {
7017 if (cpipe->res_word != RES_FOR && cpipe->res_word != RES_IN) 7017 struct pipe *cpipe;
7018 continue; 7018 for (cpipe = pi; cpipe; cpipe = cpipe->next) {
7019 /* current word is FOR or IN (BOLD in comments below) */ 7019 if (cpipe->res_word != RES_FOR && cpipe->res_word != RES_IN)
7020 if (cpipe->next == NULL) { 7020 continue;
7021 syntax_error("malformed for"); 7021 /* current word is FOR or IN (BOLD in comments below) */
7022 debug_leave(); 7022 if (cpipe->next == NULL) {
7023 debug_printf_exec("run_list lvl %d return 1\n", G.run_list_level); 7023 syntax_error("malformed for");
7024 return 1; 7024 debug_leave();
7025 } 7025 debug_printf_exec("run_list lvl %d return 1\n", G.run_list_level);
7026 /* "FOR v; do ..." and "for v IN a b; do..." are ok */ 7026 return 1;
7027 if (cpipe->next->res_word == RES_DO) 7027 }
7028 continue; 7028 /* "FOR v; do ..." and "for v IN a b; do..." are ok */
7029 /* next word is not "do". It must be "in" then ("FOR v in ...") */ 7029 if (cpipe->next->res_word == RES_DO)
7030 if (cpipe->res_word == RES_IN /* "for v IN a b; not_do..."? */ 7030 continue;
7031 || cpipe->next->res_word != RES_IN /* FOR v not_do_and_not_in..."? */ 7031 /* next word is not "do". It must be "in" then ("FOR v in ...") */
7032 ) { 7032 if (cpipe->res_word == RES_IN /* "for v IN a b; not_do..."? */
7033 syntax_error("malformed for"); 7033 || cpipe->next->res_word != RES_IN /* FOR v not_do_and_not_in..."? */
7034 debug_leave(); 7034 ) {
7035 debug_printf_exec("run_list lvl %d return 1\n", G.run_list_level); 7035 syntax_error("malformed for");
7036 return 1; 7036 debug_leave();
7037 debug_printf_exec("run_list lvl %d return 1\n", G.run_list_level);
7038 return 1;
7039 }
7037 } 7040 }
7038 } 7041 }
7039#endif 7042#endif