From 4539512afc2b29654a1a9695489cde475e3467ec Mon Sep 17 00:00:00 2001 From: eban Date: Thu, 27 Nov 2003 08:00:23 +0000 Subject: [PATCH] * 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 --- ChangeLog | 4 ++++ win32/win32.c | 26 ++++++++++++-------------- 2 files changed, 16 insertions(+), 14 deletions(-) diff --git a/ChangeLog b/ChangeLog index b5a37de2d9..6ae5e19a90 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +Thu Nov 27 16:58:48 2003 WATANABE Hirofumi + + * win32/win32.c (rb_w32_stat): remove _fullpath() for NUL: device. + Wed Nov 26 15:38:47 2003 WATANABE Hirofumi * test/fileutils/test_fileutils.rb: should take the existing symbolic diff --git a/win32/win32.c b/win32/win32.c index 81eca672a9..6a7f6be9b8 100644 --- a/win32/win32.c +++ b/win32/win32.c @@ -2695,7 +2695,7 @@ isUNCRoot(const char *path) if (*p == '\\') break; } - if (!p[0] || !p[1]) + if (!p[0] || !p[1] || (p[0] == '\\' && p[1] == '.')) return 1; } } @@ -2706,7 +2706,7 @@ int rb_w32_stat(const char *path, struct stat *st) { const char *p; - char *buf1, *buf2, *s; + char *buf1, *s, *end; int len; int ret; @@ -2727,23 +2727,21 @@ rb_w32_stat(const char *path, struct stat *st) errno = ENOENT; return -1; } - p = CharPrev(buf1, buf1 + len); + end = CharPrev(buf1, buf1 + len); if (isUNCRoot(buf1)) { - if (*p != '\\') + if (*end == '.') + *end = '\0'; + else if (*end != '\\') strcat(buf1, "\\"); - } else if (*p == '\\' || *p == ':') + } else if (*end == '\\' || *end == ':') strcat(buf1, "."); - buf2 = ALLOCA_N(char, MAXPATHLEN); - if (_fullpath(buf2, buf1, MAXPATHLEN)) { - ret = stat(buf2, st); - if (ret == 0) { - st->st_mode &= ~(S_IWGRP | S_IWOTH); - } - return ret; + + ret = stat(buf1, st); + if (ret == 0) { + st->st_mode &= ~(S_IWGRP | S_IWOTH); } - else - return -1; + return ret; } static long