0001-src-main.c-fix-build-with-gcc-4.8.patch 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. From e871a7ad19f6b38d9c0a1c6cf554692b5cdea9bc Mon Sep 17 00:00:00 2001
  2. From: Fabrice Fontaine <fontaine.fabrice@gmail.com>
  3. Date: Sun, 7 Jun 2020 23:25:55 +0200
  4. Subject: [PATCH] src/main.c: fix build with gcc <= 4.8
  5. Since commit 719e44277f8e89323a87219b4d4bc7abac05b051, build with
  6. gcc <= 4.8 fails on:
  7. main.c:186:2: error: 'for' loop initial declarations are only allowed in C99 mode
  8. for (size_t i = IDX_INTERACTIVE + 1; i < NR_NFT_OPTIONS; ++i)
  9. ^
  10. Fixes:
  11. - http://autobuild.buildroot.org/results/cf2359b8311fe91f9335c91f2bb4a730c9f4c9dc
  12. Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
  13. [Upstream status:
  14. https://marc.info/?l=netfilter-devel&m=159156583001993]
  15. ---
  16. src/main.c | 3 ++-
  17. 1 file changed, 2 insertions(+), 1 deletion(-)
  18. diff --git a/src/main.c b/src/main.c
  19. index d830c7a2..e248a347 100644
  20. --- a/src/main.c
  21. +++ b/src/main.c
  22. @@ -169,6 +169,7 @@ static void print_option(const struct nft_opt *opt)
  23. static void show_help(const char *name)
  24. {
  25. + size_t i;
  26. printf("Usage: %s [ options ] [ cmds... ]\n"
  27. "\n"
  28. "Options:\n", name);
  29. @@ -185,7 +186,7 @@ static void show_help(const char *name)
  30. fputs("\n", stdout);
  31. - for (size_t i = IDX_INTERACTIVE + 1; i < NR_NFT_OPTIONS; ++i)
  32. + for (i = IDX_INTERACTIVE + 1; i < NR_NFT_OPTIONS; ++i)
  33. print_option(&nft_options[i]);
  34. fputs("\n", stdout);
  35. --
  36. 2.26.2