From 9740f34d11c458fd7a07a025810422a6db1ad374 Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Tue, 31 Oct 2006 11:40:47 +0000 Subject: * fhandler_disk_file.cc (fhandler_base::fstat_by_handle): Drop directory attribute for reparse points to avoid mistreating. (fhandler_base::fstat_by_name): Ditto. * path.cc (symlink_info::check_reparse_point): New method testing reparse points for symbolic links. (symlink_info::check_shortcut): Move file attribute tesat to calling function. (symlink_info::check): Add handling for reparse points. * path.h (enum path_types): Add PATH_REP to denote reparse point based symlinks. (path_conv::is_rep_symlink): New method. * syscalls.cc (unlink): Handle reparse points. --- winsup/cygwin/fhandler_disk_file.cc | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'winsup/cygwin/fhandler_disk_file.cc') diff --git a/winsup/cygwin/fhandler_disk_file.cc b/winsup/cygwin/fhandler_disk_file.cc index da358bd1d..f3b5ec03e 100644 --- a/winsup/cygwin/fhandler_disk_file.cc +++ b/winsup/cygwin/fhandler_disk_file.cc @@ -240,6 +240,8 @@ fhandler_base::fstat_by_handle (struct __stat64 *buf) /* If the change time is 0, it's a file system which doesn't support a change timestamp. In that case use the LastWriteTime entry, as in other calls to fstat_helper. */ + if (pc.is_rep_symlink ()) + pfai->BasicInformation.FileAttributes &= ~FILE_ATTRIBUTE_DIRECTORY; pc.file_attributes (pfai->BasicInformation.FileAttributes); return fstat_helper (buf, pfai->BasicInformation.ChangeTime.QuadPart ? @@ -275,7 +277,11 @@ fhandler_base::fstat_by_handle (struct __stat64 *buf) local.dwFileAttributes = DWORD (pc); } else - pc.file_attributes (local.dwFileAttributes); + { + if (pc.is_rep_symlink ()) + local.dwFileAttributes &= ~FILE_ATTRIBUTE_DIRECTORY; + pc.file_attributes (local.dwFileAttributes); + } return fstat_helper (buf, local.ftLastWriteTime, /* see fstat_helper comment */ local.ftLastAccessTime, @@ -306,6 +312,8 @@ fhandler_base::fstat_by_name (struct __stat64 *buf) else if ((handle = FindFirstFile (pc, &local)) != INVALID_HANDLE_VALUE) { FindClose (handle); + if (pc.is_rep_symlink ()) + local.dwFileAttributes &= ~FILE_ATTRIBUTE_DIRECTORY; pc.file_attributes (local.dwFileAttributes); res = fstat_helper (buf, local.ftLastWriteTime, /* see fstat_helper comment */ -- cgit v1.2.3