summaryrefslogtreecommitdiff
path: root/file.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-05-26 07:26:36 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-05-26 07:26:36 +0000
commit5212b7fb5206329151f52532e0818832186f0346 (patch)
tree1592961eaad50452efa2042a16d3ed8700161564 /file.c
parent62bab7fc22ed4668fc2cca4b85965644046a1169 (diff)
file.c: fix for UNC
* file.c (realpath_rec): UNC prefix does not end with path separator, so new separator is needed after it. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35806 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'file.c')
-rw-r--r--file.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/file.c b/file.c
index bb1ab371f8..846f3147f9 100644
--- a/file.c
+++ b/file.c
@@ -3350,6 +3350,13 @@ realpath_rec(long *prefixlenp, VALUE *resolvedp, const char *unresolved, VALUE l
VALUE testpath = rb_str_dup(*resolvedp);
if (*prefixlenp < RSTRING_LEN(testpath))
rb_str_cat2(testpath, "/");
+#if defined(DOSISH_UNC) || defined(DOSISH_DRIVE_LETTER)
+ if (*prefixlenp > 1 && *prefixlenp == RSTRING_LEN(testpath)) {
+ const char *prefix = RSTRING_PTR(testpath);
+ const char *last = rb_enc_left_char_head(prefix, prefix + *prefixlenp - 1, prefix + *prefixlenp, enc);
+ if (!isdirsep(*last)) rb_str_cat2(testpath, "/");
+ }
+#endif
rb_str_cat(testpath, testname, testnamelen);
checkval = rb_hash_aref(loopcheck, testpath);
if (!NIL_P(checkval)) {