aboutsummaryrefslogtreecommitdiffstats
path: root/dir.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-08-19 23:31:19 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-08-19 23:31:19 +0000
commit26787c7b29d3612c78306e2a9ea0382f089b5a2b (patch)
treeaff76c76efa54f43fd0b4103328c09c979f83018 /dir.c
parentf7957897fab36c3ea686f73d9b1c04fd2de649cc (diff)
downloadruby-26787c7b29d3612c78306e2a9ea0382f089b5a2b.tar.gz
win32.c: support known reparse points only
* dir.c (replace_real_basename), win32/win32.c (opendir_internal): check reparse point tags and treat supported tags only as symbolic links. [ruby-core:70454] [Bug #11462] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51644 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'dir.c')
-rw-r--r--dir.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/dir.c b/dir.c
index b75e6d63c5..abb5295dc8 100644
--- a/dir.c
+++ b/dir.c
@@ -1512,6 +1512,7 @@ replace_real_basename(char *path, long base, rb_encoding *enc, int norm_p, int f
}
#elif defined _WIN32
VALUE rb_w32_conv_from_wchar(const WCHAR *wstr, rb_encoding *enc);
+int rb_w32_reparse_symlink_p(const WCHAR *path);
static char *
replace_real_basename(char *path, long base, rb_encoding *enc, int norm_p, int flags, rb_pathtype_t *type)
@@ -1539,6 +1540,10 @@ replace_real_basename(char *path, long base, rb_encoding *enc, int norm_p, int f
h = FindFirstFileW(wplain, &fd);
e = rb_w32_map_errno(GetLastError());
}
+ if (fa.dwFileAttributes & FILE_ATTRIBUTE_REPARSE_POINT) {
+ if (!rb_w32_reparse_symlink_p(wplain))
+ fa.dwFileAttributes &= ~FILE_ATTRIBUTE_REPARSE_POINT;
+ }
free(wplain);
if (h == INVALID_HANDLE_VALUE) {
*type = path_noent;