summaryrefslogtreecommitdiff
path: root/dir.c
diff options
context:
space:
mode:
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;