summaryrefslogtreecommitdiff
path: root/win32
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
commit4539512afc2b29654a1a9695489cde475e3467ec (patch)
treee8f5f4e1cfec4c1ee45fa5ad11ed659f8d38f82e /win32
parentf3e1738d9c27c90730f355a6cabe6741178114ab (diff)
* 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
Diffstat (limited to 'win32')
-rw-r--r--win32/win32.c26
1 files changed, 12 insertions, 14 deletions
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