* win32/win32.c (rb_w32_stat): remove _fullpath() for NUL: device.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5035 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
eban 2003-11-27 08:00:23 +00:00
parent f3e1738d9c
commit 4539512afc
2 changed files with 16 additions and 14 deletions

View File

@ -1,3 +1,7 @@
Thu Nov 27 16:58:48 2003 WATANABE Hirofumi <eban@ruby-lang.org>
* win32/win32.c (rb_w32_stat): remove _fullpath() for NUL: device.
Wed Nov 26 15:38:47 2003 WATANABE Hirofumi <eban@ruby-lang.org> Wed Nov 26 15:38:47 2003 WATANABE Hirofumi <eban@ruby-lang.org>
* test/fileutils/test_fileutils.rb: should take the existing symbolic * test/fileutils/test_fileutils.rb: should take the existing symbolic

View File

@ -2695,7 +2695,7 @@ isUNCRoot(const char *path)
if (*p == '\\') if (*p == '\\')
break; break;
} }
if (!p[0] || !p[1]) if (!p[0] || !p[1] || (p[0] == '\\' && p[1] == '.'))
return 1; return 1;
} }
} }
@ -2706,7 +2706,7 @@ int
rb_w32_stat(const char *path, struct stat *st) rb_w32_stat(const char *path, struct stat *st)
{ {
const char *p; const char *p;
char *buf1, *buf2, *s; char *buf1, *s, *end;
int len; int len;
int ret; int ret;
@ -2727,23 +2727,21 @@ rb_w32_stat(const char *path, struct stat *st)
errno = ENOENT; errno = ENOENT;
return -1; return -1;
} }
p = CharPrev(buf1, buf1 + len); end = CharPrev(buf1, buf1 + len);
if (isUNCRoot(buf1)) { if (isUNCRoot(buf1)) {
if (*p != '\\') if (*end == '.')
*end = '\0';
else if (*end != '\\')
strcat(buf1, "\\"); strcat(buf1, "\\");
} else if (*p == '\\' || *p == ':') } else if (*end == '\\' || *end == ':')
strcat(buf1, "."); strcat(buf1, ".");
buf2 = ALLOCA_N(char, MAXPATHLEN);
if (_fullpath(buf2, buf1, MAXPATHLEN)) { ret = stat(buf1, st);
ret = stat(buf2, st); if (ret == 0) {
if (ret == 0) { st->st_mode &= ~(S_IWGRP | S_IWOTH);
st->st_mode &= ~(S_IWGRP | S_IWOTH);
}
return ret;
} }
else return ret;
return -1;
} }
static long static long