]> code.delx.au - gnu-emacs/blobdiff - src/fileio.c
coding.c (decode_coding_iso_2022): When an invalid escape sequence is encountered...
[gnu-emacs] / src / fileio.c
index 2047338f03eafcc54c97cf9377dfd0b9942423ab..1049522e5a973cfdf97a363f2968bf7c9ae1eb80 100644 (file)
@@ -81,6 +81,25 @@ 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)
+#elif defined WINDOWSNT
+#define ACL_NOT_WELL_SUPPORTED(Err)  ((Err) == ENOTSUP)
+#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 +2030,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 +2074,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 +2106,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 +2195,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 +3193,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);
@@ -5816,7 +5835,7 @@ before any other event (mouse or keypress) is handled.  */)
   if ((NILP (last_nonmenu_event) || CONSP (last_nonmenu_event))
       && use_dialog_box
       && use_file_dialog
-      && have_menus_p ())
+      && window_system_available (SELECTED_FRAME ()))
     return Qt;
 #endif
   return Qnil;