Building a testdir on CentOS 6, I get this compilation error:

depbase=`echo file-has-acl.o | sed 's|[^/]*$|.deps/&|;s|\.o$||'`;\
        gcc -std=gnu99 -DHAVE_CONFIG_H -DEXEEXT=\"\" -DEXEEXT=\"\" -DNO_XMALLOC 
-DEXEEXT=\"\" -I. -I../../gllib -I..  -DGNULIB_STRICT_CHECKING=1 
-I/home/bruno/inst-x86_64-64/include -Wall -fvisibility=hidden -g -O -MT 
file-has-acl.o -MD -MP -MF $depbase.Tpo -c -o file-has-acl.o 
../../gllib/file-has-acl.c &&\
        mv -f $depbase.Tpo $depbase.Po
../../gllib/file-has-acl.c: In function 'get_aclinfo':
../../gllib/file-has-acl.c:177: error: 'XATTR_NAME_SMACK' undeclared (first use 
in this function)
../../gllib/file-has-acl.c:177: error: (Each undeclared identifier is reported 
only once
../../gllib/file-has-acl.c:177: error: for each function it appears in.)
make[4]: *** [file-has-acl.o] Error 1

This patch fixes it.


2024-12-28  Bruno Haible  <br...@clisp.org>

        file-has-acl: Fix compilation error on CentOS 6 (regression 2024-09-29).
        * lib/file-has-acl.c (XATTR_NAME_SMACK, XATTR_NAME_SELINUX): Add
        fallback definitions.

diff --git a/lib/file-has-acl.c b/lib/file-has-acl.c
index 7c29f20158..73e148613a 100644
--- a/lib/file-has-acl.c
+++ b/lib/file-has-acl.c
@@ -55,6 +55,12 @@ static char const UNKNOWN_SECURITY_CONTEXT[] = "?";
 # include <arpa/inet.h>
 # include <sys/xattr.h>
 # include <linux/xattr.h>
+# ifndef XATTR_NAME_SMACK
+#  define XATTR_NAME_SMACK "security.SMACK64"
+# endif
+# ifndef XATTR_NAME_SELINUX
+#  define XATTR_NAME_SELINUX "security.selinux"
+# endif
 # ifndef XATTR_NAME_NFSV4_ACL
 #  define XATTR_NAME_NFSV4_ACL "system.nfs4_acl"
 # endif




Reply via email to