From: Romain Francoise Date: Sun, 7 Apr 2013 11:21:39 +0000 (+0200) Subject: Ignore additional platform-specific ACL errors (Bug#13702). X-Git-Tag: emacs-24.3.90~173^2^2~42^2~45^2~387^2~2026^2~511 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=5406cfd9cd748a2d83a0c9eb38849ace83a10cb2;p=emacs.git Ignore additional platform-specific ACL errors (Bug#13702). * fileio.c (ACL_NOT_WELL_SUPPORTED): New macro copied from gnulib. (Fcopy_file, Fset_file_acl) [HAVE_POSIX_ACL]: Use it. --- diff --git a/src/ChangeLog b/src/ChangeLog index 545df8e050f..be654602cc8 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,9 @@ +2013-04-07 Romain Francoise + + Ignore additional platform-specific ACL errors (Bug#13702). + * fileio.c (ACL_NOT_WELL_SUPPORTED): New macro copied from gnulib. + (Fcopy_file, Fset_file_acl) [HAVE_POSIX_ACL]: Use it. + 2013-03-31 Jan Djärv * nsterm.m (ns_mouse_position): Use NS_FRAME_P instead of checking diff --git a/src/fileio.c b/src/fileio.c index bffaff0609d..076cdfbc2ff 100644 --- a/src/fileio.c +++ b/src/fileio.c @@ -81,6 +81,23 @@ along with GNU Emacs. If not, see . */ #define DRIVE_LETTER(x) c_tolower (x) #endif +#ifdef HAVE_POSIX_ACL +/* FIXME: this macro was copied from gnulib's private acl-internal.h + header file. */ +/* Recognize some common errors such as from an NFS mount that does + not support ACLs, even when local drives do. */ +#if defined __APPLE__ && defined __MACH__ /* Mac OS X */ +#define ACL_NOT_WELL_SUPPORTED(Err) \ + ((Err) == ENOTSUP || (Err) == ENOSYS || (Err) == EINVAL || (Err) == EBUSY || (Err) == ENOENT) +#elif defined EOPNOTSUPP /* Tru64 NFS */ +#define ACL_NOT_WELL_SUPPORTED(Err) \ + ((Err) == ENOTSUP || (Err) == ENOSYS || (Err) == EINVAL || (Err) == EBUSY || (Err) == EOPNOTSUPP) +#else +#define ACL_NOT_WELL_SUPPORTED(Err) \ + ((Err) == ENOTSUP || (Err) == ENOSYS || (Err) == EINVAL || (Err) == EBUSY) +#endif +#endif /* HAVE_POSIX_ACL */ + #include "systime.h" #include #include @@ -2011,7 +2028,7 @@ entries (depending on how Emacs was built). */) { #ifdef HAVE_POSIX_ACL acl = acl_get_file (SDATA (encoded_file), ACL_TYPE_ACCESS); - if (acl == NULL && errno != ENOTSUP) + if (acl == NULL && !ACL_NOT_WELL_SUPPORTED (errno)) report_file_error ("Getting ACL", Fcons (file, Qnil)); #endif } @@ -2055,7 +2072,7 @@ entries (depending on how Emacs was built). */) { bool fail = acl_set_file (SDATA (encoded_newname), ACL_TYPE_ACCESS, acl) != 0; - if (fail && errno != ENOTSUP) + if (fail && !ACL_NOT_WELL_SUPPORTED (errno)) report_file_error ("Setting ACL", Fcons (newname, Qnil)); acl_free (acl); @@ -2087,7 +2104,7 @@ entries (depending on how Emacs was built). */) #ifdef HAVE_POSIX_ACL acl = acl_get_fd (ifd); - if (acl == NULL && errno != ENOTSUP) + if (acl == NULL && !ACL_NOT_WELL_SUPPORTED (errno)) report_file_error ("Getting ACL", Fcons (file, Qnil)); #endif } @@ -2176,7 +2193,7 @@ entries (depending on how Emacs was built). */) if (acl != NULL) { bool fail = acl_set_fd (ofd, acl) != 0; - if (fail && errno != ENOTSUP) + if (fail && !ACL_NOT_WELL_SUPPORTED (errno)) report_file_error ("Setting ACL", Fcons (newname, Qnil)); acl_free (acl); @@ -3174,7 +3191,7 @@ support. */) fail = (acl_set_file (SSDATA (encoded_absname), ACL_TYPE_ACCESS, acl) != 0); - if (fail && errno != ENOTSUP) + if (fail && !ACL_NOT_WELL_SUPPORTED (errno)) report_file_error ("Setting ACL", Fcons (absname, Qnil)); acl_free (acl);