]> code.delx.au - gnu-emacs/commitdiff
Ignore additional platform-specific ACL errors (Bug#13702).
authorRomain Francoise <romain@orebokech.com>
Sun, 7 Apr 2013 11:21:39 +0000 (13:21 +0200)
committerRomain Francoise <romain@orebokech.com>
Sun, 7 Apr 2013 11:21:39 +0000 (13:21 +0200)
* fileio.c (ACL_NOT_WELL_SUPPORTED): New macro copied from gnulib.
(Fcopy_file, Fset_file_acl) [HAVE_POSIX_ACL]: Use it.

src/ChangeLog
src/fileio.c

index 545df8e050f5df312904d944ec19d82057848ffc..be654602cc85a62d587be80318da080e5c61e866 100644 (file)
@@ -1,3 +1,9 @@
+2013-04-07  Romain Francoise  <romain@orebokech.com>
+
+       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  <jan.h.d@swipnet.se>
 
        * nsterm.m (ns_mouse_position): Use NS_FRAME_P instead of checking
index bffaff0609d5f97164405473361ce1da890df04a..076cdfbc2ffb7f2f1650b1957aeb0815de774b6f 100644 (file)
@@ -81,6 +81,23 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #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 <allocator.h>
 #include <careadlinkat.h>
@@ -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);