+2008-06-08 Bruno Haible <bruno@clisp.org>
+
+ * lib/acl-internal.h (acl_extended_nontrivial) [MacOS X]: New
+ declaration.
+ * lib/file-has-acl.c (acl_extended_nontrivial) [MacOS X]: New function.
+ (acl_access_nontrivial): Remove MacOS X case.
+ (file_has_acl): Use acl_extended_nontrivial.
+ * lib/copy-acl.c (qcopy_acl): Likewise.
+
2008-06-08 Bruno Haible <bruno@clisp.org>
* lib/set-mode-acl.c (qset_acl): Trivial code simplifications.
extern int acl_entries (acl_t);
# endif
+# if HAVE_ACL_TYPE_EXTENDED /* MacOS X */
+/* ACL is an ACL, from a file, stored as type ACL_TYPE_EXTENDED.
+ Return 1 if the given ACL is non-trivial.
+ Return 0 if it is trivial. */
+extern int acl_extended_nontrivial (acl_t);
+# else
/* ACL is an ACL, from a file, stored as type ACL_TYPE_ACCESS.
Return 1 if the given ACL is non-trivial.
Return 0 if it is trivial, i.e. equivalent to a simple stat() mode.
Return -1 and set errno upon failure to determine it. */
extern int acl_access_nontrivial (acl_t);
+# endif
# endif
#if USE_ACL && HAVE_ACL_GET_FILE
+# if HAVE_ACL_TYPE_EXTENDED /* MacOS X */
+
+/* ACL is an ACL, from a file, stored as type ACL_TYPE_EXTENDED.
+ Return 1 if the given ACL is non-trivial.
+ Return 0 if it is trivial. */
+int
+acl_extended_nontrivial (acl_t acl)
+{
+ /* acl is non-trivial if it is non-empty. */
+ return (acl_entries (acl) > 0);
+}
+
+# else /* Linux, FreeBSD, IRIX, Tru64 */
+
/* ACL is an ACL, from a file, stored as type ACL_TYPE_ACCESS.
Return 1 if the given ACL is non-trivial.
Return 0 if it is trivial, i.e. equivalent to a simple stat() mode.
int
acl_access_nontrivial (acl_t acl)
{
-# if MODE_INSIDE_ACL /* Linux, FreeBSD, IRIX, Tru64 */
/* acl is non-trivial if it has some entries other than for "user::",
"group::", and "other::". Normally these three should be present
at least, allowing us to write
# endif
# endif
-# else /* MacOS X */
+}
- /* acl is non-trivial if it is non-empty. */
- return (acl_entries (acl) > 0);
# endif
-}
#endif
acl_t acl = acl_get_file (name, ACL_TYPE_EXTENDED);
if (acl)
{
- ret = (0 < acl_entries (acl));
+ ret = acl_extended_nontrivial (acl);
acl_free (acl);
}
else