From d974d420d494228ea759e08013805888c5f13ac0 Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Wed, 22 Jul 2009 18:49:48 +0000 Subject: [PATCH] * mount.cc (fs_info::update): Open filesystem with access set to 0. Explain why. --- winsup/cygwin/ChangeLog | 5 +++++ winsup/cygwin/mount.cc | 10 ++++++---- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index 09223afb7..f4c75a307 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,8 @@ +2009-07-22 Corinna Vinschen + + * mount.cc (fs_info::update): Open filesystem with access set to 0. + Explain why. + 2009-07-22 Corinna Vinschen * mount.cc: Revert accidental checkin. diff --git a/winsup/cygwin/mount.cc b/winsup/cygwin/mount.cc index ed1ab90d4..64583c7ab 100644 --- a/winsup/cygwin/mount.cc +++ b/winsup/cygwin/mount.cc @@ -133,8 +133,11 @@ fs_info::update (PUNICODE_STRING upath, HANDLE in_vol) /* Always caseinsensitive. We really just need access to the drive. */ InitializeObjectAttributes (&attr, upath, OBJ_CASE_INSENSITIVE, NULL, NULL); - status = NtOpenFile (&vol, READ_CONTROL, &attr, &io, - FILE_SHARE_VALID_FLAGS, FILE_OPEN_FOR_BACKUP_INTENT); + /* At least one filesystem (HGFS, VMware shared folders) doesn't like + to be opened with acces set to just READ_CONTROL. No worries, since + filesystem information is available without any access bit set. */ + status = NtOpenFile (&vol, 0, &attr, &io, FILE_SHARE_VALID_FLAGS, + FILE_OPEN_FOR_BACKUP_INTENT); while (!NT_SUCCESS (status) && (attr.ObjectName->Length > 7 * sizeof (WCHAR) || status == STATUS_NO_MEDIA_IN_DEVICE)) @@ -149,8 +152,7 @@ fs_info::update (PUNICODE_STRING upath, HANDLE in_vol) } else if (dir.Length > 7 * sizeof (WCHAR)) dir.Length -= sizeof (WCHAR); - status = NtOpenFile (&vol, READ_CONTROL, &attr, &io, - FILE_SHARE_VALID_FLAGS, + status = NtOpenFile (&vol, 0, &attr, &io, FILE_SHARE_VALID_FLAGS, FILE_OPEN_FOR_BACKUP_INTENT); } if (!NT_SUCCESS (status))