summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoreban <eban@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-11-27 08:00:23 +0000
committereban <eban@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-11-27 08:00:23 +0000
commit4e1588ba77f19391ba10819ab5ef0c61a9d6b1bc (patch)
treee8f5f4e1cfec4c1ee45fa5ad11ed659f8d38f82e
parent49329271619cbb061b04f727455a3484d53de9f5 (diff)
downloadruby-4e1588ba77f19391ba10819ab5ef0c61a9d6b1bc.tar.gz
ruby-4e1588ba77f19391ba10819ab5ef0c61a9d6b1bc.tar.xz
ruby-4e1588ba77f19391ba10819ab5ef0c61a9d6b1bc.zip
* win32/win32.c (rb_w32_stat): remove _fullpath() for NUL: device.
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@5035 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog4
-rw-r--r--win32/win32.c26
2 files changed, 16 insertions, 14 deletions
diff --git a/ChangeLog b/ChangeLog
index b5a37de2d..6ae5e19a9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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>
* test/fileutils/test_fileutils.rb: should take the existing symbolic
diff --git a/win32/win32.c b/win32/win32.c
index 81eca672a..6a7f6be9b 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