kumquat-buildroot/package/libselinux/0001-fix-musl-build.patch
Adam Duskett 889157e1e8 package/libselinux: bump version to 3.0
Other changes:
  - Remove upstream patches.
  - Modify existing patches to work with 3.0.
  - Remove Python2 check, as 3.0 has removed Python2 support.

Signed-off-by: Adam Duskett <aduskett@gmail.com>
Signed-off-by: Matt Weber <matthew.weber@rockwellcollins.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
2020-04-17 22:13:39 +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.0]
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
@@ -65,6 +65,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