[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: acl: finish support for MacOS X
From: |
Bruno Haible |
Subject: |
Re: acl: finish support for MacOS X |
Date: |
Sun, 8 Jun 2008 14:01:15 +0200 |
User-agent: |
KMail/1.5.4 |
Jim Meyering wrote:
> > + if (ret != 0)
> > + {
> > + int saved_errno = errno;
> > +
> > + if (ACL_NOT_WELL_SUPPORTED (errno) && !(acl_entries (acl) > 0))
> > + {
>
> Why use the negation?
That's for analogy with the Linux/FreeBSD/... code a couple of lines above.
The "acl_entries (acl) > 0" expression represents the same abstraction as
acl_access_nontrivial. To make it clearer, I'm committing this:
2008-06-08 Bruno Haible <address@hidden>
* 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.
*** lib/acl-internal.h.orig 2008-06-08 13:51:04.000000000 +0200
--- lib/acl-internal.h 2008-06-08 13:47:11.000000000 +0200
***************
*** 145,155 ****
--- 145,162 ----
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
*** lib/file-has-acl.c.orig 2008-06-08 13:51:04.000000000 +0200
--- lib/file-has-acl.c 2008-06-08 13:49:45.000000000 +0200
***************
*** 26,31 ****
--- 26,45 ----
#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.
***************
*** 33,39 ****
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
--- 47,52 ----
***************
*** 100,111 ****
# endif
# endif
! # else /* MacOS X */
- /* acl is non-trivial if it is non-empty. */
- return (acl_entries (acl) > 0);
# endif
- }
#endif
--- 113,121 ----
# endif
# endif
! }
# endif
#endif
***************
*** 144,150 ****
acl_t acl = acl_get_file (name, ACL_TYPE_EXTENDED);
if (acl)
{
! ret = (0 < acl_entries (acl));
acl_free (acl);
}
else
--- 154,160 ----
acl_t acl = acl_get_file (name, ACL_TYPE_EXTENDED);
if (acl)
{
! ret = acl_extended_nontrivial (acl);
acl_free (acl);
}
else
*** lib/copy-acl.c.orig 2008-06-08 13:51:04.000000000 +0200
--- lib/copy-acl.c 2008-06-08 13:50:27.000000000 +0200
***************
*** 155,161 ****
{
int saved_errno = errno;
! if (ACL_NOT_WELL_SUPPORTED (errno) && !(acl_entries (acl) > 0))
{
acl_free (acl);
return chmod_or_fchmod (dst_name, dest_desc, mode);
--- 155,161 ----
{
int saved_errno = errno;
! if (ACL_NOT_WELL_SUPPORTED (errno) && !acl_extended_nontrivial (acl))
{
acl_free (acl);
return chmod_or_fchmod (dst_name, dest_desc, mode);