hush: fix build breakage (variable declared in for())
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
		
							
								
								
									
										45
									
								
								shell/hush.c
									
									
									
									
									
								
							
							
						
						
									
										45
									
								
								shell/hush.c
									
									
									
									
									
								
							| @@ -7013,27 +7013,30 @@ static int run_list(struct pipe *pi) | |||||||
|  |  | ||||||
| #if ENABLE_HUSH_LOOPS | #if ENABLE_HUSH_LOOPS | ||||||
| 	/* Check syntax for "for" */ | 	/* Check syntax for "for" */ | ||||||
| 	for (struct pipe *cpipe = pi; cpipe; cpipe = cpipe->next) { | 	{ | ||||||
| 		if (cpipe->res_word != RES_FOR && cpipe->res_word != RES_IN) | 		struct pipe *cpipe; | ||||||
| 			continue; | 		for (cpipe = pi; cpipe; cpipe = cpipe->next) { | ||||||
| 		/* current word is FOR or IN (BOLD in comments below) */ | 			if (cpipe->res_word != RES_FOR && cpipe->res_word != RES_IN) | ||||||
| 		if (cpipe->next == NULL) { | 				continue; | ||||||
| 			syntax_error("malformed for"); | 			/* current word is FOR or IN (BOLD in comments below) */ | ||||||
| 			debug_leave(); | 			if (cpipe->next == NULL) { | ||||||
| 			debug_printf_exec("run_list lvl %d return 1\n", G.run_list_level); | 				syntax_error("malformed for"); | ||||||
| 			return 1; | 				debug_leave(); | ||||||
| 		} | 				debug_printf_exec("run_list lvl %d return 1\n", G.run_list_level); | ||||||
| 		/* "FOR v; do ..." and "for v IN a b; do..." are ok */ | 				return 1; | ||||||
| 		if (cpipe->next->res_word == RES_DO) | 			} | ||||||
| 			continue; | 			/* "FOR v; do ..." and "for v IN a b; do..." are ok */ | ||||||
| 		/* next word is not "do". It must be "in" then ("FOR v in ...") */ | 			if (cpipe->next->res_word == RES_DO) | ||||||
| 		if (cpipe->res_word == RES_IN /* "for v IN a b; not_do..."? */ | 				continue; | ||||||
| 		 || cpipe->next->res_word != RES_IN /* FOR v not_do_and_not_in..."? */ | 			/* next word is not "do". It must be "in" then ("FOR v in ...") */ | ||||||
| 		) { | 			if (cpipe->res_word == RES_IN /* "for v IN a b; not_do..."? */ | ||||||
| 			syntax_error("malformed for"); | 			 || cpipe->next->res_word != RES_IN /* FOR v not_do_and_not_in..."? */ | ||||||
| 			debug_leave(); | 			) { | ||||||
| 			debug_printf_exec("run_list lvl %d return 1\n", G.run_list_level); | 				syntax_error("malformed for"); | ||||||
| 			return 1; | 				debug_leave(); | ||||||
|  | 				debug_printf_exec("run_list lvl %d return 1\n", G.run_list_level); | ||||||
|  | 				return 1; | ||||||
|  | 			} | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
| #endif | #endif | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user