diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2002-12-01 13:46:24 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2002-12-01 13:46:24 +0000 |
commit | a63e599a530edd6a0d6b43ee31d98d05f4855e99 (patch) | |
tree | f3ec38590d957c938e1cf4b5a3a52edd09585c46 /win32 | |
parent | 5705a0ee9ee6662abf8a7bcc58b111793348175c (diff) |
* win32/win32.c (win32_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/branches/ruby_1_6@3101 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'win32')
-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 a1cc9fc94e..78b3925640 100644 --- a/win32/win32.c +++ b/win32/win32.c @@ -2629,13 +2629,12 @@ win32_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 != '\\') |