0001-fix-musl-build.patch 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. From 78f7f09028fdd6a5e8e4e4b584749621eaef412f Mon Sep 17 00:00:00 2001
  2. From: Yann E. MORIN" <yann.morin.1998@free.fr>
  3. Date: Sat, 7 Dec 2019 17:24:50 -0800
  4. Subject: [PATCH] fix undefined macros in musl
  5. musl does not define glibc-specific macros, so use a simple version of
  6. the macro when it is not defined.
  7. This is very inefficient, however, but copying the code from glibc is
  8. not really possible because it is LGPL while libselinux in Public
  9. Domain, and we want to avoid license propagation, so this macro is
  10. completely written from scratch, and non-optimal.
  11. Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
  12. [Updated for 3.0]
  13. Signed-off-by: Adam Duskett <Aduskett@gmail.com>
  14. diff --git a/src/booleans.c b/src/booleans.c
  15. index ffa8d26..8569002 100644
  16. --- a/src/booleans.c
  17. +++ b/src/booleans.c
  18. @@ -65,6 +65,14 @@ int security_get_boolean_names(char ***names, int *len)
  19. goto bad;
  20. }
  21. +/* Simple (but inefficient) version of _D_ALLOC_NAMLEN when
  22. + * building with a C library that misses it (e.g. musl).
  23. + * Note: glibc does a strlen on (d)->d_name, so assume it is safe.
  24. + */
  25. +#ifndef _D_ALLOC_NAMLEN
  26. +#define _D_ALLOC_NAMLEN(d) (strlen((d)->d_name)+1)
  27. +#endif
  28. +
  29. for (i = 0; i < *len; i++) {
  30. n[i] = strdup(namelist[i]->d_name);
  31. if (!n[i]) {
  32. --
  33. 2.23.0