[PATCH] hush.c: compile option: fix -std=c99,gnu99 errors
Denys Vlasenko
vda.linux at googlemail.com
Sat Dec 18 00:33:49 UTC 2010
On Friday 17 December 2010 04:51, Macpaul Lin wrote:
> 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) */
(This is not the best fix, gcc warns when decls are intermixed to statements)
Thanks for the heads up, fixing...
--
vda
More information about the busybox
mailing list