0002-Programs-pgmprivs_linux.c-fix-build-with-gcc-5.patch 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. From 92b3fca2d55757680398b55869214fc2d19e9b71 Mon Sep 17 00:00:00 2001
  2. From: Fabrice Fontaine <fontaine.fabrice@gmail.com>
  3. Date: Sun, 21 Feb 2021 20:47:06 +0100
  4. Subject: [PATCH] Programs/pgmprivs_linux.c: fix build with gcc < 5
  5. Build with gcc < 5 is broken since version 6.2 and
  6. https://github.com/brltty/brltty/commit/8ce262f2c15f10a40d9cbae0b3c88b466970a055:
  7. ./pgmprivs_linux.c: In function 'getPrivilegeParameterNames':
  8. ./pgmprivs_linux.c:2220:3: error: array initialized from non-constant array expression
  9. static const char *const names[] = NULL_TERMINATED_STRING_ARRAY(
  10. ^
  11. Build was partially fixed since
  12. https://github.com/brltty/brltty/commit/8ae78dd560d00c5074158f90be5ac8dac80183db
  13. but it forgot to update pgmprivs_linux.c
  14. Fixes:
  15. - http://autobuild.buildroot.org/results/58afeb50a0ecdb8b527d7c9946bcae290b79b055
  16. Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
  17. [yann.morin.1998@free.fr: use an actual backport after upstream merge]
  18. Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
  19. ---
  20. Programs/pgmprivs_linux.c | 12 +++++++-----
  21. 1 file changed, 7 insertions(+), 5 deletions(-)
  22. diff --git a/Programs/pgmprivs_linux.c b/Programs/pgmprivs_linux.c
  23. index 56e464a82..7dfabaf9b 100644
  24. --- a/Programs/pgmprivs_linux.c
  25. +++ b/Programs/pgmprivs_linux.c
  26. @@ -2215,13 +2215,15 @@ typedef enum {
  27. PARM_USER,
  28. } Parameters;
  29. +
  30. +static const char *const *const pgmprivs_names =
  31. + NULL_TERMINATED_STRING_ARRAY(
  32. + "path", "scfmode", "shell", "user"
  33. + );
  34. +
  35. const char *const *
  36. getPrivilegeParameterNames (void) {
  37. - static const char *const names[] = NULL_TERMINATED_STRING_ARRAY(
  38. - "path", "scfmode", "shell", "user"
  39. - );
  40. -
  41. - return names;
  42. + return pgmprivs_names;
  43. }
  44. const char *
  45. --
  46. 2.25.1