+2015-04-26 Paul Eggert <eggert@cs.ucla.edu>
+
+ file-has-acl: port to CentOS 6
+ Problem reported by Tom G. Christensen in:
+ http://lists.gnu.org/archive/html/bug-gnulib/2015-04/msg00074.html
+ * lib/file-has-acl.c: Use GETXATTR_WITH_POSIX_ACLS instead of a
+ combination of HAVE_SYS_XATTR_H, HAVE_LINUX_XATTR_H, and
+ HAVE_GETXATTR.
+ * m4/acl.m4 (gl_FILE_HAS_ACL): Test fot the entire combination of
+ linux/xattr.h, sys/xattr.h, getxattr, XATTR_NAME_POSIX_ACL_ACCESS,
+ and XATTR_NAME_POSIX_ACL_DEFAULT, since that's what what
+ file-has-acl.c actually needs.
+
2015-04-26 Pádraig Brady <P@draigBrady.com>
file-has-acl: always return false when ACLs aren't supported
#include "acl-internal.h"
-#if HAVE_SYS_XATTR_H
+#if GETXATTR_WITH_POSIX_ACLS
# include <sys/xattr.h>
-#endif
-
-#if HAVE_LINUX_XATTR_H
# include <linux/xattr.h>
#endif
if (! S_ISLNK (sb->st_mode))
{
-# if HAVE_GETXATTR && defined XATTR_NAME_POSIX_ACL_ACCESS && defined XATTR_NAME_POSIX_ACL_DEFAULT
+# if GETXATTR_WITH_POSIX_ACLS
ssize_t ret;
# acl.m4 - check for access control list (ACL) primitives
-# serial 18
+# serial 19
# Copyright (C) 2002, 2004-2015 Free Software Foundation, Inc.
# This file is free software; the Free Software Foundation
[
AC_REQUIRE([gl_FUNC_ACL_ARG])
if test "$enable_acl" != no; then
- AC_CHECK_HEADERS([linux/xattr.h],
- [AC_CHECK_HEADERS([sys/xattr.h],
- [AC_CHECK_FUNCS([getxattr])])])
+ AC_CACHE_CHECK([for getxattr with XATTR_NAME_POSIX_ACL macros],
+ [gl_cv_getxattr_with_posix_acls],
+ [gl_cv_getxattr_with_posix_acls=no
+ AC_LINK_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[#include <sys/types.h>
+ #include <sys/xattr.h>
+ #include <linux/xattr.h>
+ ]],
+ [[ssize_t a = getxattr (".", XATTR_NAME_POSIX_ACL_ACCESS, 0, 0);
+ ssize_t b = getxattr (".", XATTR_NAME_POSIX_ACL_DEFAULT, 0, 0);
+ return a < 0 || b < 0;
+ ]])],
+ [gl_cv_getxattr_with_posix_acls=yes])])
fi
- if test "$ac_cv_header_sys_xattr_h,$ac_cv_header_linux_xattr_h,$ac_cv_func_getxattr" = yes,yes,yes; then
+ if test "$gl_cv_getxattr_with_posix_acls" = yes; then
LIB_HAS_ACL=
+ AC_DEFINE([GETXATTR_WITH_POSIX_ACLS], 1,
+ [Define to 1 if getxattr works with XATTR_NAME_POSIX_ACL_ACCESS
+ and XATTR_NAME_POSIX_ACL_DEFAULT.])
else
dnl Set gl_need_lib_has_acl to a nonempty value, so that any
dnl later gl_FUNC_ACL call will set LIB_HAS_ACL=$LIB_ACL.