https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=185cd97d24150db8964754ae0cbb69102dd6cfdb
commit 185cd97d24150db8964754ae0cbb69102dd6cfdb Author: Corinna Vinschen <cori...@vinschen.de> Date: Tue Jun 20 10:06:17 2017 +0200 cygwin: readdir: Activate check for remote reparse points Fix and move comment accordingly. Signed-off-by: Corinna Vinschen <cori...@vinschen.de> Diff: --- winsup/cygwin/fhandler_disk_file.cc | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/winsup/cygwin/fhandler_disk_file.cc b/winsup/cygwin/fhandler_disk_file.cc index f8adcaa..ca1da38 100644 --- a/winsup/cygwin/fhandler_disk_file.cc +++ b/winsup/cygwin/fhandler_disk_file.cc @@ -189,6 +189,10 @@ readdir_check_reparse_point (POBJECT_ATTRIBUTES attr, bool remote) &io, FSCTL_GET_REPARSE_POINT, NULL, 0, (LPVOID) rp, MAXIMUM_REPARSE_DATA_BUFFER_SIZE))) { + /* If reparse point is stored on a remote volume, lstat returns + them as normal files or dirs, not as symlink. For a description, + see the comment preceeding remote check in + symlink_info::check_reparse_point. */ if (!remote && rp->ReparseTag == IO_REPARSE_TAG_MOUNT_POINT) { RtlInitCountedUnicodeString (&subst, @@ -2028,10 +2032,7 @@ fhandler_disk_file::readdir_helper (DIR *dir, dirent *de, DWORD w32_err, InitializeObjectAttributes (&oattr, fname, pc.objcaseinsensitive (), get_handle (), NULL); - /* FUTURE: Ideally would know at this point if reparse point - is stored on a remote volume. Without this, may return DT_LNK - for remote names that end up lstat-ing as a normal directory. */ - if (readdir_check_reparse_point (&oattr, false/*remote*/)) + if (readdir_check_reparse_point (&oattr, isremote ())) de->d_type = DT_LNK; }