buildroot/package/libselinux/0001-fix-musl-build.patch
Adam Duskett 1db27ce253 package/libselinux: bump to version 3.5
- libselinux now requires pip, just to perform the install of the python
  bindings; it still uses setuptools to do the actual build;
- rebase patches for version 3.5;
- backport a fix for the install of the python bindings.

Signed-off-by: Adam Duskett <aduskett@gmail.com>
[yann.morin.1998@free.fr:
  - backport upstream patch to fix installation of python bindings
]
Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
2023-05-09 22:13:20 +02:00

39 lines
1.2 KiB
Diff

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