diff options
| author | Eli Zaretskii | 2017-01-27 10:51:53 +0200 |
|---|---|---|
| committer | Eli Zaretskii | 2017-01-27 10:51:53 +0200 |
| commit | 525a6d2c4fcd4a319e196ede0513275f6b07eb2c (patch) | |
| tree | e17b376c08aa68349160ce9f548947daf76e8fe8 /src | |
| parent | e26166aae0616264a476cac3ba1e2c5979d442b5 (diff) | |
| download | emacs-525a6d2c4fcd4a319e196ede0513275f6b07eb2c.tar.gz emacs-525a6d2c4fcd4a319e196ede0513275f6b07eb2c.zip | |
Don't report zero errno for inaccessible directory
* src/fileio.c (Ffile_accessible_directory_p): Report EACCES when
a file handler reports a failure. (Bug#25419)
Diffstat (limited to 'src')
| -rw-r--r-- | src/fileio.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/fileio.c b/src/fileio.c index ac6d7819411..8e549a44855 100644 --- a/src/fileio.c +++ b/src/fileio.c | |||
| @@ -2815,7 +2815,14 @@ really is a readable and searchable directory. */) | |||
| 2815 | if (!NILP (handler)) | 2815 | if (!NILP (handler)) |
| 2816 | { | 2816 | { |
| 2817 | Lisp_Object r = call2 (handler, Qfile_accessible_directory_p, absname); | 2817 | Lisp_Object r = call2 (handler, Qfile_accessible_directory_p, absname); |
| 2818 | errno = 0; | 2818 | |
| 2819 | /* This might be a lie (e.g., the directory might not exist, or | ||
| 2820 | be a regular file), but at least it does TRT in the "usual" | ||
| 2821 | case of an existing directory that is not accessible by the | ||
| 2822 | current user, and avoids reporting "Success" for a failed | ||
| 2823 | operation. */ | ||
| 2824 | if (!EQ (r, Qt)) | ||
| 2825 | errno = EACCES; | ||
| 2819 | return r; | 2826 | return r; |
| 2820 | } | 2827 | } |
| 2821 | 2828 | ||