+2008-05-22 Bruno Haible <bruno@clisp.org>
+
+ Add support for ACLs on OSF/1.
+ * lib/acl-internal.h (acl_get_fd, acl_set_fd): New inline function
+ replacements.
+ (acl_free_text): New macro fallback.
+ * lib/acl_entries.c (acl_entries): Use acl_free_text instead of
+ acl_free.
+ * m4/acl.m4 (gl_FUNC_ACL): Look also in libpacl library. Test for
+ acl_free_text function. Require AC_C_INLINE.
+
2008-05-22 Bruno Haible <bruno@clisp.org>
Make copy_acl work on MacOS X 10.5.
#endif
/* POSIX 1003.1e (draft 17) */
-#ifndef HAVE_ACL_GET_FD
+#ifdef HAVE_ACL_GET_FD
+/* Most platforms have a 1-argument acl_get_fd, only OSF/1 has a 2-argument
+ macro(!). */
+# if HAVE_ACL_FREE_TEXT /* OSF/1 */
+static inline acl_t
+rpl_acl_get_fd (int fd)
+{
+ return acl_get_fd (fd, ACL_TYPE_ACCESS);
+}
+# undef acl_get_fd
+# define acl_get_fd rpl_acl_get_fd
+# endif
+#else
# define HAVE_ACL_GET_FD false
# undef acl_get_fd
# define acl_get_fd(fd) (NULL)
#endif
/* POSIX 1003.1e (draft 17) */
-#ifndef HAVE_ACL_SET_FD
+#ifdef HAVE_ACL_SET_FD
+/* Most platforms have a 2-argument acl_set_fd, only OSF/1 has a 3-argument
+ macro(!). */
+# if HAVE_ACL_FREE_TEXT /* OSF/1 */
+static inline int
+rpl_acl_set_fd (int fd, acl_t acl)
+{
+ return acl_set_fd (fd, ACL_TYPE_ACCESS, acl);
+}
+# undef acl_set_fd
+# define acl_set_fd rpl_acl_set_fd
+# endif
+#else
# define HAVE_ACL_SET_FD false
# undef acl_set_fd
# define acl_set_fd(fd, acl) (-1)
#endif
+/* POSIX 1003.1e (draft 13) */
+#if ! HAVE_ACL_FREE_TEXT
+# define acl_free_text(buf) acl_free (buf)
+#endif
+
/* Linux-specific */
#ifndef HAVE_ACL_EXTENDED_FILE
# define HAVE_ACL_EXTENDED_FILE false
/* Return the number of entries in an ACL.
- Copyright (C) 2002, 2003, 2005, 2006, 2007 Free Software Foundation, Inc.
+ Copyright (C) 2002-2003, 2005-2008 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
return -1;
for (t = text; *t; t++)
entries += (*t == '\n');
- acl_free (text);
+ acl_free_text (text);
return entries;
}
# acl.m4 - check for access control list (ACL) primitives
-# serial 4
+# serial 6
# Copyright (C) 2002, 2004-2008 Free Software Foundation, Inc.
# This file is free software; the Free Software Foundation
LIB_ACL=
use_acl=0
+ AC_REQUIRE([AC_C_INLINE])
if test "x$enable_acl" != "xno"; then
dnl Prerequisites of lib/acl.c.
AC_CHECK_HEADERS(sys/acl.h)
AC_CHECK_FUNCS([acl_trivial])],
[AC_CHECK_FUNCS([acl_trivial])
if test $ac_cv_func_acl_trivial != yes; then
- AC_SEARCH_LIBS([acl_get_file], [acl],
+ dnl -lacl is needed on Linux, -lpacl is needed on OSF/1.
+ AC_SEARCH_LIBS([acl_get_file], [acl pacl],
[test "$ac_cv_search_acl_get_file" = "none required" ||
LIB_ACL=$ac_cv_search_acl_get_file
AC_CHECK_FUNCS(
acl_delete_def_file acl_extended_file \
acl_delete_fd_np acl_delete_file_np \
acl_copy_ext_native acl_create_entry_np \
- acl_to_short_text])
+ acl_to_short_text acl_free_text])
if test $ac_cv_func_acl_get_file = yes; then
# If the acl_get_file bug is detected, disable all ACL support.
gl_ACL_GET_FILE( , [use_acl=0])