diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2002-12-01 13:47:06 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2002-12-01 13:47:06 +0000 |
commit | c405dbf6927080f54300006b7b5a0e17c5c8a68c (patch) | |
tree | 6e42892f1611542842f47df62b5cc12a831d6160 /win32/win32.c | |
parent | 59d4702438117396de9f899a0c96fe64654b0262 (diff) | |
download | ruby-c405dbf6927080f54300006b7b5a0e17c5c8a68c.tar.gz |
* win32/win32.c (rb_w32_stat): empty path is invalid, and return
ENOENT rather than EBADF in such case. [ruby-talk:57177]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3102 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'win32/win32.c')
-rw-r--r-- | win32/win32.c | 9 |
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 != '\\') |