Skip to contentSkip to conversation

libselinux: fix compilation with musl

PATCH New Renato Caldas 1 participant 1 message Jun 29, 2023

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 libselinux: fix compilation with musl

From: Renato Caldas <[email protected]>

---
 ...re-drop-the-obsolete-LSF-transitiona.patch | 39 +++++++++++++++++++
 recipes-security/selinux/libselinux_3.5.bb    |  5 +++
 2 files changed, 44 insertions(+)
 create mode 100644 recipes-security/selinux/libselinux/0003-libselinux-restore-drop-the-obsolete-LSF-transitiona.patch
recipes-security/selinux/libselinux/0003-libselinux-restore-drop-the-obsolete-LSF-transitiona.patch new file +39 -0
new file mode 100644
index 0000000..5b37395
@@ -0,0 +1,39 @@
+From a822176c6f181d1e6989900dfc58bbdab6d9065a Mon Sep 17 00:00:00 2001
+From: Renato Caldas <[email protected]>
+Date: Thu, 29 Jun 2023 13:59:11 +0100
+Subject: [PATCH] libselinux: restore: drop the obsolete LSF transitional API.
+
+The preferred way to enable LSF support on 32 bit systems is to define
+_FILE_OFFSET_BITS=64 when building selinux.
+
+Upstream-Status: Submitted [https://github.com/SELinuxProject/selinux/pull/401]
+
+Signed-off-by: Renato Caldas <[email protected]>
+---
+ libselinux/src/selinux_restorecon.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/libselinux/src/selinux_restorecon.c b/libselinux/src/selinux_restorecon.c
+index 7ef2d45d..2ff920b0 100644
+--- a/src/selinux_restorecon.c
++++ b/src/selinux_restorecon.c
+@@ -437,7 +437,7 @@ static int filespec_add(ino_t ino, const char *con, const char *file,
+ 	file_spec_t *prevfl, *fl;
+ 	uint32_t h;
+ 	int ret;
+-	struct stat64 sb;
++	struct stat sb;
+
+ 	__pthread_mutex_lock(&fl_mutex);
+
+@@ -451,7 +451,7 @@ static int filespec_add(ino_t ino, const char *con, const char *file,
+ 	for (prevfl = &fl_head[h], fl = fl_head[h].next; fl;
+ 	     prevfl = fl, fl = fl->next) {
+ 		if (ino == fl->ino) {
+-			ret = lstat64(fl->file, &sb);
++			ret = lstat(fl->file, &sb);
+ 			if (ret < 0 || sb.st_ino != ino) {
+ 				freecon(fl->con);
+ 				free(fl->file);
+--
+2.41.0
recipes-security/selinux/libselinux_3.5.bb +5 -0
index 8009d6d..37383eb 100644
@@ -10,6 +10,11 @@ require selinux_common.inc
 
 inherit lib_package pkgconfig
 
+FILESEXTRAPATHS:prepend := "${THISDIR}/libselinux:"
+SRC_URI += "\
+        file://0003-libselinux-restore-drop-the-obsolete-LSF-transitiona.patch \
+        "
+
 DEPENDS = "libsepol libpcre2"
 DEPENDS:append:libc-musl = " fts"
 
Signature · 1 line
2.41.0