summaryrefslogtreecommitdiff
path: root/win32/file.c
diff options
context:
space:
mode:
authornaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-03-29 17:17:50 +0000
committernaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-03-29 17:17:50 +0000
commit710fe14b5d1e00f9ae2d3fb49670b91a27dbe233 (patch)
tree1d9efd5e94b0a0c241aa09015d57e174bcf70b5e /win32/file.c
parentf08d8f722f6338fa024c22b651c9e9078d85999d (diff)
merge revision(s) 53688,53689,53690,53702: [Backport #11874]
* win32/win32.c (fileattr_to_unixmode, rb_w32_reparse_symlink_p): volume mount point should be treated as directory, not symlink. [ruby-core:72483] [Bug #11874] * win32/win32.c (rb_w32_read_reparse_point): check the reparse point is a volume mount point or not. * win32/file.c (rb_readlink): follow above change (but this pass won't be used). * win32/file.c (rb_readlink): drop garbage after the substitute name, as rb_w32_read_reparse_point returns the expected buffer size but "\??\" prefix is dropped from the result. * win32/win32.c (w32_readlink): ditto, including NUL-terminator. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_3@54424 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'win32/file.c')
-rw-r--r--win32/file.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/win32/file.c b/win32/file.c
index 46a7ec7d5d..3b18a36348 100644
--- a/win32/file.c
+++ b/win32/file.c
@@ -689,11 +689,15 @@ rb_readlink(VALUE path, rb_encoding *resultenc)
ALLOCV_END(wpathbuf);
if (e) {
ALLOCV_END(wtmp);
- rb_syserr_fail_path(rb_w32_map_errno(e), path);
+ if (e != -1)
+ rb_syserr_fail_path(rb_w32_map_errno(e), path);
+ else /* not symlink; maybe volume mount point */
+ rb_syserr_fail_path(EINVAL, path);
}
enc = resultenc;
cp = path_cp = code_page(enc);
if (cp == INVALID_CODE_PAGE) cp = CP_UTF8;
+ len = lstrlenW(wbuf);
str = append_wstr(rb_enc_str_new(0, 0, enc), wbuf, len, cp, path_cp, enc);
ALLOCV_END(wtmp);
return str;