0002-parser-Makefile-dont-force-host-cpp-to-detect-reallocarray.patch 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. From 0dbcbee70097ecde66708064ec1dedfa64e581e8 Mon Sep 17 00:00:00 2001
  2. From: Armin Kuster <akuster@mvista.com>
  3. Date: Wed, 7 Oct 2020 20:50:38 -0700
  4. Subject: [PATCH] parser/Makefile: dont force host cpp to detect reallocarray
  5. In cross build environments, using the hosts cpp gives incorrect
  6. detection of reallocarray. Change cpp to a variable.
  7. fixes:
  8. parser_misc.c: In function 'int capable_add_cap(const char*, int, unsigned int, capability_flags)':
  9. | parser_misc.c:297:37: error: 'reallocarray' was not declared in this scope
  10. | 297 | tmp = (struct capability_table *) reallocarray(cap_table, sizeof(struct capability_table), cap_table_size+1);
  11. Signed-off-by: Armin Kuster <akuster808@gmail.com>
  12. [Retrieved from:
  13. https://gitlab.com/ffontaine/apparmor/-/commit/0dbcbee70097ecde66708064ec1dedfa64e581e8]
  14. Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
  15. ---
  16. parser/Makefile | 2 +-
  17. 1 file changed, 1 insertion(+), 1 deletion(-)
  18. diff --git a/parser/Makefile b/parser/Makefile
  19. index acef3d77a..8250ac451 100644
  20. --- a/parser/Makefile
  21. +++ b/parser/Makefile
  22. @@ -54,7 +54,7 @@ endif
  23. CPPFLAGS += -D_GNU_SOURCE
  24. STDLIB_INCLUDE:="\#include <stdlib.h>"
  25. -HAVE_REALLOCARRAY:=$(shell echo $(STDLIB_INCLUDE) | cpp ${CPPFLAGS} | grep -q reallocarray && echo true)
  26. +HAVE_REALLOCARRAY:=$(shell echo $(STDLIB_INCLUDE) | ${CPP} ${CPPFLAGS} | grep -q reallocarray && echo true)
  27. WARNINGS = -Wall
  28. CXX_WARNINGS = ${WARNINGS} ${EXTRA_WARNINGS}
  29. --
  30. GitLab