aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/w32.c29
1 files changed, 26 insertions, 3 deletions
diff --git a/src/w32.c b/src/w32.c
index d7a91692c63..88e9aef338f 100644
--- a/src/w32.c
+++ b/src/w32.c
@@ -4151,13 +4151,36 @@ w32_accessible_directory_p (const char *dirname, ptrdiff_t dirlen)
4151 /* In case DIRNAME cannot be expressed in characters from the 4151 /* In case DIRNAME cannot be expressed in characters from the
4152 current ANSI codepage. */ 4152 current ANSI codepage. */
4153 if (_mbspbrk (pat_a, "?")) 4153 if (_mbspbrk (pat_a, "?"))
4154 dh = INVALID_HANDLE_VALUE; 4154 {
4155 else 4155 errno = ENOENT;
4156 dh = FindFirstFileA (pat_a, &dfd_a); 4156 return 0;
4157 }
4158 dh = FindFirstFileA (pat_a, &dfd_a);
4157 } 4159 }
4158 4160
4159 if (dh == INVALID_HANDLE_VALUE) 4161 if (dh == INVALID_HANDLE_VALUE)
4162 {
4163 DWORD w32err = GetLastError ();
4164
4165 switch (w32err)
4166 {
4167 case ERROR_INVALID_NAME:
4168 case ERROR_BAD_PATHNAME:
4169 case ERROR_FILE_NOT_FOUND:
4170 case ERROR_PATH_NOT_FOUND:
4171 case ERROR_NO_MORE_FILES:
4172 case ERROR_BAD_NETPATH:
4173 errno = ENOENT;
4174 break;
4175 case ERROR_NOT_READY:
4176 errno = ENODEV;
4177 break;
4178 default:
4179 errno = EACCES;
4180 break;
4181 }
4160 return 0; 4182 return 0;
4183 }
4161 FindClose (dh); 4184 FindClose (dh);
4162 return 1; 4185 return 1;
4163} 4186}