0003-libselinux-utils-getseuser.c-fix-build-with-gcc-4.8.patch 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. From 5c4ddfc88f0a7f10a5e9edddbdbe8e8ef1f9945e Mon Sep 17 00:00:00 2001
  2. From: Fabrice Fontaine <fontaine.fabrice@gmail.com>
  3. Date: Thu, 10 Jun 2021 07:38:02 +0200
  4. Subject: [PATCH] libselinux/utils/getseuser.c: fix build with gcc 4.8
  5. Fix the following build failure with gcc 4.8 which is raised since
  6. version 3.2 and
  7. https://github.com/SELinuxProject/selinux/commit/156dd0de5cad31e7d437c64e11a8aef027f0a691
  8. getseuser.c:53:2: error: 'for' loop initial declarations are only allowed in C99 mode
  9. for (int i = 0; i < n; i++)
  10. ^
  11. Fixes:
  12. - http://autobuild.buildroot.org/results/37eb0952a763256fbf6ef3c668f6c95fbdf2dd35
  13. Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
  14. [Upstream status: https://github.com/SELinuxProject/selinux/pull/289]
  15. ---
  16. libselinux/utils/getseuser.c | 4 ++--
  17. 1 file changed, 2 insertions(+), 2 deletions(-)
  18. diff --git a/utils/getseuser.c b/utils/getseuser.c
  19. index ce1b7b27..34f2e887 100644
  20. --- a/utils/getseuser.c
  21. +++ b/utils/getseuser.c
  22. @@ -9,7 +9,7 @@ int main(int argc, char **argv)
  23. {
  24. char *seuser = NULL, *level = NULL;
  25. char **contextlist;
  26. - int rc, n;
  27. + int rc, n, i;
  28. if (argc != 3) {
  29. fprintf(stderr, "usage: %s linuxuser fromcon\n", argv[0]);
  30. @@ -50,7 +50,7 @@ int main(int argc, char **argv)
  31. if (n == 0)
  32. printf("no valid context found\n");
  33. - for (int i = 0; i < n; i++)
  34. + for (i = 0; i < n; i++)
  35. printf("Context %d\t%s\n", i, contextlist[i]);
  36. freeconary(contextlist);
  37. --
  38. 2.30.2