diff options
Diffstat (limited to 'win32')
-rw-r--r-- | win32/win32.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/win32/win32.c b/win32/win32.c index 7fa962f15b..d819dba2ee 100644 --- a/win32/win32.c +++ b/win32/win32.c @@ -1333,7 +1333,9 @@ rb_w32_opendir(const char *filename) // check to see if we've got a directory // - if ((rb_w32_stat(filename, &sbuf) < 0 || ( + if (rb_w32_stat(filename, &sbuf) < 0) + return NULL; + if ((( #ifdef __BORLANDC__ (unsigned short)(sbuf.st_mode) #else @@ -1342,6 +1344,7 @@ rb_w32_opendir(const char *filename) & _S_IFDIR) == 0) && (!ISALPHA(filename[0]) || filename[1] != ':' || filename[2] != '\0' || ((1 << (filename[0] & 0x5f) - 'A') & GetLogicalDrives()) == 0)) { + errno = ENOTDIR; return NULL; } |