summaryrefslogtreecommitdiff
path: root/file.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-02-17 04:27:45 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-02-17 04:27:45 +0000
commit8fe2085eb774e216da8298eaf922c1c928a49905 (patch)
tree17c47ed7c74eb304a27eed24148cd6ddd02b6e76 /file.c
parentd0d70d648d7ef2a8c1de2f141b1ab5cda109d561 (diff)
*** empty log message ***
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3498 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'file.c')
-rw-r--r--file.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/file.c b/file.c
index cb7c2c8..581e490 100644
--- a/file.c
+++ b/file.c
@@ -1591,7 +1591,6 @@ file_expand_path(fname, dname, result)
strcpy(buf, dir);
free(dir);
}
- p = skiproot(buf);
#ifdef DOSISH
if (isdirsep(*s)) {
/* specified full path, but not drive letter nor UNC */
@@ -1601,24 +1600,24 @@ file_expand_path(fname, dname, result)
}
else if (isdirsep(buf[0]) && isdirsep(buf[1])) {
/* or UNC share name */
- if (*(p = nextdirsep(p))) p = nextdirsep(p + 1);
+ if (*(p = nextdirsep(buf + 2))) p = nextdirsep(p + 1);
}
}
else
#endif
- if (*p)
- p = chompdirsep(p);
- else if (p > buf)
- --p;
+ p = chompdirsep(skiproot(buf));
}
else {
b = s;
do s++; while (isdirsep(*s));
- p = buf + (s - b) - 1;
+ p = buf + (s - b);
BUFCHECK(p >= pend);
memset(buf, '/', p - buf);
}
- *p = '/';
+ if (p > buf && p[-1] == '/')
+ --p;
+ else
+ *p = '/';
b = s;
while (*s) {