diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/fileio.c | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/src/fileio.c b/src/fileio.c index 0977516f019..58bc6b7ee8c 100644 --- a/src/fileio.c +++ b/src/fileio.c | |||
| @@ -253,9 +253,23 @@ file_attribute_errno (Lisp_Object file, int err) | |||
| 253 | return file_metadata_errno ("Getting attributes", file, err); | 253 | return file_metadata_errno ("Getting attributes", file, err); |
| 254 | } | 254 | } |
| 255 | 255 | ||
| 256 | /* In theory, EACCES errors for predicates like file-readable-p should | ||
| 257 | be checked further because they may be problems with an ancestor | ||
| 258 | directory instead of with the file itself, which means that we | ||
| 259 | don't have reliable info about the requested file. In practice, | ||
| 260 | though, such errors are common enough that signaling them can be | ||
| 261 | annoying even if the errors are real (e.g., Bug#37445). So return | ||
| 262 | nil for EACCES unless compiling with -DPICKY_EACCES, which is off | ||
| 263 | by default. */ | ||
| 264 | #ifndef PICKY_EACCES | ||
| 265 | enum { PICKY_EACCES = false }; | ||
| 266 | #endif | ||
| 267 | |||
| 256 | static Lisp_Object | 268 | static Lisp_Object |
| 257 | file_test_errno (Lisp_Object file, int err) | 269 | file_test_errno (Lisp_Object file, int err) |
| 258 | { | 270 | { |
| 271 | if (!PICKY_EACCES && err == EACCES) | ||
| 272 | return Qnil; | ||
| 259 | return file_metadata_errno ("Testing file", file, err); | 273 | return file_metadata_errno ("Testing file", file, err); |
| 260 | } | 274 | } |
| 261 | 275 | ||
| @@ -2745,7 +2759,7 @@ check_file_access (Lisp_Object file, Lisp_Object operation, int amode) | |||
| 2745 | return Qt; | 2759 | return Qt; |
| 2746 | int err = errno; | 2760 | int err = errno; |
| 2747 | if (err == EROFS || err == ETXTBSY | 2761 | if (err == EROFS || err == ETXTBSY |
| 2748 | || (err == EACCES && amode != F_OK | 2762 | || (PICKY_EACCES && err == EACCES && amode != F_OK |
| 2749 | && file_access_p (encoded_file, F_OK))) | 2763 | && file_access_p (encoded_file, F_OK))) |
| 2750 | { | 2764 | { |
| 2751 | errno = err; | 2765 | errno = err; |