diff options
| author | Eli Zaretskii | 2015-01-28 19:42:28 +0200 |
|---|---|---|
| committer | Eli Zaretskii | 2015-01-28 19:42:28 +0200 |
| commit | ad588afdaa166bcdacbf9f746bd4d39b2c649768 (patch) | |
| tree | c3562982b7a711957cc43a87163e8ca791aa9dab /src/dired.c | |
| parent | ba10f4b56081d0f5069720c9ce0871e819b904f5 (diff) | |
| download | emacs-ad588afdaa166bcdacbf9f746bd4d39b2c649768.tar.gz emacs-ad588afdaa166bcdacbf9f746bd4d39b2c649768.zip | |
Improve the fix for bug #19701
src/dired.c (directory_files_internal, file_name_completion)
[WINDOWSNT]: Signal an error when errno is set non-zero by
'readdir', regardless of its value.
src/w32.c (sys_readdir): Set errno to ENOENT when the directory
doesn't exist and to EACCES when it's not accessible to the
current user. Set errno to zero when FindNextFile exhausts the
directory, so that callers don't interpret that as an error and
don't signal a file-error.
(open_unc_volume): Set errno to ENOENT if WNetOpenEnum fails.
Diffstat (limited to 'src/dired.c')
| -rw-r--r-- | src/dired.c | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/src/dired.c b/src/dired.c index f6c47a71400..43cb8373a6d 100644 --- a/src/dired.c +++ b/src/dired.c | |||
| @@ -251,14 +251,9 @@ directory_files_internal (Lisp_Object directory, Lisp_Object full, | |||
| 251 | /* The MS-Windows implementation of 'opendir' doesn't | 251 | /* The MS-Windows implementation of 'opendir' doesn't |
| 252 | actually open a directory until the first call to | 252 | actually open a directory until the first call to |
| 253 | 'readdir'. If 'readdir' fails to open the directory, it | 253 | 'readdir'. If 'readdir' fails to open the directory, it |
| 254 | sets errno to ENOTDIR; we convert it here to ENOENT so | 254 | sets errno to ENOENT or EACCES, see w32.c. */ |
| 255 | that the error message is similar to what happens on | 255 | if (errno) |
| 256 | Posix hosts in such cases. */ | 256 | report_file_error ("Opening directory", directory); |
| 257 | if (errno == ENOTDIR) | ||
| 258 | { | ||
| 259 | errno = ENOENT; | ||
| 260 | report_file_error ("Opening directory", directory); | ||
| 261 | } | ||
| 262 | #endif | 257 | #endif |
| 263 | break; | 258 | break; |
| 264 | } | 259 | } |
| @@ -530,6 +525,10 @@ file_name_completion (Lisp_Object file, Lisp_Object dirname, bool all_flag, | |||
| 530 | QUIT; | 525 | QUIT; |
| 531 | continue; | 526 | continue; |
| 532 | } | 527 | } |
| 528 | #ifdef WINDOWSNT | ||
| 529 | if (errno) | ||
| 530 | report_file_error ("Opening directory", dirname); | ||
| 531 | #endif | ||
| 533 | break; | 532 | break; |
| 534 | } | 533 | } |
| 535 | 534 | ||