summaryrefslogtreecommitdiff
path: root/dir.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-08-19 23:31:19 (GMT)
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-08-19 23:31:19 (GMT)
commit82da3da5aca885fc7995c426696cb7798faad3d6 (patch)
treeaff76c76efa54f43fd0b4103328c09c979f83018 /dir.c
parent126eb641e38be37966fafbed6af8b340bd41a2e3 (diff)
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 b75e6d6..abb5295 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;