summaryrefslogtreecommitdiff
path: root/win32
diff options
context:
space:
mode:
Diffstat (limited to 'win32')
-rw-r--r--win32/win32.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/win32/win32.c b/win32/win32.c
index c4086fe159..4ac661ecfc 100644
--- a/win32/win32.c
+++ b/win32/win32.c
@@ -2539,13 +2539,12 @@ rb_w32_stat(const char *path, struct stat *st)
*s = *p;
}
*s = '\0';
- len = strlen(buf1);
- p = CharPrev(buf1, buf1 + len);
- if( '\"' == *(--s) )
- {
- errno = EBADF;
+ len = s - buf1;
+ if (!len || '\"' == *(--s)) {
+ errno = ENOENT;
return -1;
}
+ p = CharPrev(buf1, buf1 + len);
if (isUNCRoot(buf1)) {
if (*p != '\\')