summaryrefslogtreecommitdiffstats
path: root/winsup/cygwin/fhandler_disk_file.cc
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2006-10-31 11:40:47 +0000
committerCorinna Vinschen <corinna@vinschen.de>2006-10-31 11:40:47 +0000
commit9740f34d11c458fd7a07a025810422a6db1ad374 (patch)
treef534b30bf61b4392013eabe56906a053207a3acc /winsup/cygwin/fhandler_disk_file.cc
parent3ddf69712bc97460fe6b0e82379e0c1132dce866 (diff)
downloadcygnal-9740f34d11c458fd7a07a025810422a6db1ad374.tar.gz
cygnal-9740f34d11c458fd7a07a025810422a6db1ad374.tar.bz2
cygnal-9740f34d11c458fd7a07a025810422a6db1ad374.zip
* 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.
Diffstat (limited to 'winsup/cygwin/fhandler_disk_file.cc')
-rw-r--r--winsup/cygwin/fhandler_disk_file.cc10
1 files changed, 9 insertions, 1 deletions
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 */