summaryrefslogtreecommitdiff
path: root/win32
diff options
context:
space:
mode:
authoreban <eban@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2001-03-21 14:12:09 +0000
committereban <eban@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2001-03-21 14:12:09 +0000
commit424c3fb43d59d7e47952152ff03ba6ea6c6b3d22 (patch)
tree11585e5292d1e53f6e9df3ebb976f2df61a1ac56 /win32
parent7aaceb6d9a498f0987ef376ef06736fba4b482a8 (diff)
* win32/win32.c (win32_stat): WinNT/2k "//host/share" support.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1273 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'win32')
-rw-r--r--win32/win32.c25
1 files changed, 22 insertions, 3 deletions
diff --git a/win32/win32.c b/win32/win32.c
index 6f16d4ad06..55e863be94 100644
--- a/win32/win32.c
+++ b/win32/win32.c
@@ -2663,6 +2663,24 @@ myrename(const char *oldpath, const char *newpath)
return res;
}
+static int
+isUNCRoot(const char *path)
+{
+ if (path[0] == '\\' && path[1] == '\\') {
+ const char *p;
+ if (p = strchr(path + 3, '\\')) {
+ if (!p[1])
+ return 0;
+ if (p = strchr(p + 1, '\\')) {
+ if (!p[1])
+ return 1;
+ } else
+ return 1;
+ }
+ }
+ return 0;
+}
+
int
win32_stat(const char *path, struct stat *st)
{
@@ -2681,10 +2699,11 @@ win32_stat(const char *path, struct stat *st)
*s = '\0';
len = strlen(buf1);
p = CharPrev(buf1, buf1 + len);
- if (*p == '\\' || *p == ':')
+ if (isUNCRoot(buf1)) {
+ if (*p != '\\')
+ strcat(buf1, "\\");
+ } else if (*p == '\\' || *p == ':')
strcat(buf1, ".");
- else if (buf1[0] == '\\' && buf1[1] == '\\')
- strcat(buf1, "\\.");
if (_fullpath(buf2, buf1, MAXPATHLEN))
return stat(buf2, st);
else