]> git.ipfire.org Git - thirdparty/nftables.git/commitdiff
main: fix build with gcc <= 4.8
authorFabrice Fontaine <fontaine.fabrice@gmail.com>
Sun, 7 Jun 2020 21:36:47 +0000 (23:36 +0200)
committerPablo Neira Ayuso <pablo@netfilter.org>
Sun, 7 Jun 2020 22:26:36 +0000 (00:26 +0200)
Since commit 719e44277f8e89323a87219b4d4bc7abac05b051, build with
gcc <= 4.8 fails on:

main.c:186:2: error: 'for' loop initial declarations are only allowed in C99 mode
  for (size_t i = IDX_INTERACTIVE + 1; i < NR_NFT_OPTIONS; ++i)
  ^

Fixes:
 - http://autobuild.buildroot.org/results/cf2359b8311fe91f9335c91f2bb4a730c9f4c9dc

Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
src/main.c

index d830c7a2cc1bc2b33c4597ea1b81df2dd6ada151..6c18235821fc190a9f125d5437be8a1687fdc266 100644 (file)
@@ -169,6 +169,8 @@ static void print_option(const struct nft_opt *opt)
 
 static void show_help(const char *name)
 {
+       size_t i;
+
        printf("Usage: %s [ options ] [ cmds... ]\n"
               "\n"
               "Options:\n", name);
@@ -185,7 +187,7 @@ static void show_help(const char *name)
 
        fputs("\n", stdout);
 
-       for (size_t i = IDX_INTERACTIVE + 1; i < NR_NFT_OPTIONS; ++i)
+       for (i = IDX_INTERACTIVE + 1; i < NR_NFT_OPTIONS; ++i)
                print_option(&nft_options[i]);
 
        fputs("\n", stdout);