summaryrefslogtreecommitdiff
path: root/win32/win32.c
diff options
context:
space:
mode:
Diffstat (limited to 'win32/win32.c')
-rw-r--r--win32/win32.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/win32/win32.c b/win32/win32.c
index 84b574ff3c..a9598e1a94 100644
--- a/win32/win32.c
+++ b/win32/win32.c
@@ -5970,7 +5970,16 @@ rb_w32_wopen(const WCHAR *file, int oflag, ...)
pmode = va_arg(arg, int);
va_end(arg);
fd = _wopen(file, oflag, pmode);
- if (fd == -1 && errno == EACCES) check_if_wdir(file);
+ if (fd == -1) {
+ switch (errno) {
+ case EACCES:
+ check_if_wdir(file);
+ break;
+ case EINVAL:
+ errno = map_errno(GetLastError());
+ break;
+ }
+ }
return fd;
}