[PATCH] hush.c: compile option: fix -std=c99,gnu99 errors

Macpaul Lin macpaul at andestech.com
Fri Dec 17 03:51:05 UTC 2010


Variable declaration in for loop will cause compile error
in MinGW and when -std=c99,gnu99 is enabled.

Signed-off-by: Macpaul Lin <macpaul at andestech.com>
---
 shell/hush.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/shell/hush.c b/shell/hush.c
index 087636b..afa1795 100644
--- a/shell/hush.c
+++ b/shell/hush.c
@@ -7013,7 +7013,8 @@ static int run_list(struct pipe *pi)
 
 #if ENABLE_HUSH_LOOPS
 	/* Check syntax for "for" */
-	for (struct pipe *cpipe = pi; cpipe; cpipe = cpipe->next) {
+	struct pipe *cpipe = NULL;
+	for (cpipe = pi; cpipe; cpipe = cpipe->next) {
 		if (cpipe->res_word != RES_FOR && cpipe->res_word != RES_IN)
 			continue;
 		/* current word is FOR or IN (BOLD in comments below) */
-- 
1.7.3.2



More information about the busybox mailing list