diff options
| author | Romain Francoise | 2013-04-07 13:21:39 +0200 |
|---|---|---|
| committer | Romain Francoise | 2013-04-07 13:21:39 +0200 |
| commit | 5406cfd9cd748a2d83a0c9eb38849ace83a10cb2 (patch) | |
| tree | 797a19e403359ed5c6a18ee52ffdd8ee6ac06b66 /src/fileio.c | |
| parent | df4555fad10dafc50c44a4d7f97515cc9f1678c9 (diff) | |
| download | emacs-5406cfd9cd748a2d83a0c9eb38849ace83a10cb2.tar.gz emacs-5406cfd9cd748a2d83a0c9eb38849ace83a10cb2.zip | |
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.
Diffstat (limited to 'src/fileio.c')
| -rw-r--r-- | src/fileio.c | 27 |
1 files changed, 22 insertions, 5 deletions
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 <http://www.gnu.org/licenses/>. */ | |||
| 81 | #define DRIVE_LETTER(x) c_tolower (x) | 81 | #define DRIVE_LETTER(x) c_tolower (x) |
| 82 | #endif | 82 | #endif |
| 83 | 83 | ||
| 84 | #ifdef HAVE_POSIX_ACL | ||
| 85 | /* FIXME: this macro was copied from gnulib's private acl-internal.h | ||
| 86 | header file. */ | ||
| 87 | /* Recognize some common errors such as from an NFS mount that does | ||
| 88 | not support ACLs, even when local drives do. */ | ||
| 89 | #if defined __APPLE__ && defined __MACH__ /* Mac OS X */ | ||
| 90 | #define ACL_NOT_WELL_SUPPORTED(Err) \ | ||
| 91 | ((Err) == ENOTSUP || (Err) == ENOSYS || (Err) == EINVAL || (Err) == EBUSY || (Err) == ENOENT) | ||
| 92 | #elif defined EOPNOTSUPP /* Tru64 NFS */ | ||
| 93 | #define ACL_NOT_WELL_SUPPORTED(Err) \ | ||
| 94 | ((Err) == ENOTSUP || (Err) == ENOSYS || (Err) == EINVAL || (Err) == EBUSY || (Err) == EOPNOTSUPP) | ||
| 95 | #else | ||
| 96 | #define ACL_NOT_WELL_SUPPORTED(Err) \ | ||
| 97 | ((Err) == ENOTSUP || (Err) == ENOSYS || (Err) == EINVAL || (Err) == EBUSY) | ||
| 98 | #endif | ||
| 99 | #endif /* HAVE_POSIX_ACL */ | ||
| 100 | |||
| 84 | #include "systime.h" | 101 | #include "systime.h" |
| 85 | #include <allocator.h> | 102 | #include <allocator.h> |
| 86 | #include <careadlinkat.h> | 103 | #include <careadlinkat.h> |
| @@ -2011,7 +2028,7 @@ entries (depending on how Emacs was built). */) | |||
| 2011 | { | 2028 | { |
| 2012 | #ifdef HAVE_POSIX_ACL | 2029 | #ifdef HAVE_POSIX_ACL |
| 2013 | acl = acl_get_file (SDATA (encoded_file), ACL_TYPE_ACCESS); | 2030 | acl = acl_get_file (SDATA (encoded_file), ACL_TYPE_ACCESS); |
| 2014 | if (acl == NULL && errno != ENOTSUP) | 2031 | if (acl == NULL && !ACL_NOT_WELL_SUPPORTED (errno)) |
| 2015 | report_file_error ("Getting ACL", Fcons (file, Qnil)); | 2032 | report_file_error ("Getting ACL", Fcons (file, Qnil)); |
| 2016 | #endif | 2033 | #endif |
| 2017 | } | 2034 | } |
| @@ -2055,7 +2072,7 @@ entries (depending on how Emacs was built). */) | |||
| 2055 | { | 2072 | { |
| 2056 | bool fail = | 2073 | bool fail = |
| 2057 | acl_set_file (SDATA (encoded_newname), ACL_TYPE_ACCESS, acl) != 0; | 2074 | acl_set_file (SDATA (encoded_newname), ACL_TYPE_ACCESS, acl) != 0; |
| 2058 | if (fail && errno != ENOTSUP) | 2075 | if (fail && !ACL_NOT_WELL_SUPPORTED (errno)) |
| 2059 | report_file_error ("Setting ACL", Fcons (newname, Qnil)); | 2076 | report_file_error ("Setting ACL", Fcons (newname, Qnil)); |
| 2060 | 2077 | ||
| 2061 | acl_free (acl); | 2078 | acl_free (acl); |
| @@ -2087,7 +2104,7 @@ entries (depending on how Emacs was built). */) | |||
| 2087 | 2104 | ||
| 2088 | #ifdef HAVE_POSIX_ACL | 2105 | #ifdef HAVE_POSIX_ACL |
| 2089 | acl = acl_get_fd (ifd); | 2106 | acl = acl_get_fd (ifd); |
| 2090 | if (acl == NULL && errno != ENOTSUP) | 2107 | if (acl == NULL && !ACL_NOT_WELL_SUPPORTED (errno)) |
| 2091 | report_file_error ("Getting ACL", Fcons (file, Qnil)); | 2108 | report_file_error ("Getting ACL", Fcons (file, Qnil)); |
| 2092 | #endif | 2109 | #endif |
| 2093 | } | 2110 | } |
| @@ -2176,7 +2193,7 @@ entries (depending on how Emacs was built). */) | |||
| 2176 | if (acl != NULL) | 2193 | if (acl != NULL) |
| 2177 | { | 2194 | { |
| 2178 | bool fail = acl_set_fd (ofd, acl) != 0; | 2195 | bool fail = acl_set_fd (ofd, acl) != 0; |
| 2179 | if (fail && errno != ENOTSUP) | 2196 | if (fail && !ACL_NOT_WELL_SUPPORTED (errno)) |
| 2180 | report_file_error ("Setting ACL", Fcons (newname, Qnil)); | 2197 | report_file_error ("Setting ACL", Fcons (newname, Qnil)); |
| 2181 | 2198 | ||
| 2182 | acl_free (acl); | 2199 | acl_free (acl); |
| @@ -3174,7 +3191,7 @@ support. */) | |||
| 3174 | fail = (acl_set_file (SSDATA (encoded_absname), ACL_TYPE_ACCESS, | 3191 | fail = (acl_set_file (SSDATA (encoded_absname), ACL_TYPE_ACCESS, |
| 3175 | acl) | 3192 | acl) |
| 3176 | != 0); | 3193 | != 0); |
| 3177 | if (fail && errno != ENOTSUP) | 3194 | if (fail && !ACL_NOT_WELL_SUPPORTED (errno)) |
| 3178 | report_file_error ("Setting ACL", Fcons (absname, Qnil)); | 3195 | report_file_error ("Setting ACL", Fcons (absname, Qnil)); |
| 3179 | 3196 | ||
| 3180 | acl_free (acl); | 3197 | acl_free (acl); |