OSDN Git Service

* mount.cc (fs_info::update): Open filesystem with access set to 0.
authorcorinna <corinna>
Wed, 22 Jul 2009 18:49:48 +0000 (18:49 +0000)
committercorinna <corinna>
Wed, 22 Jul 2009 18:49:48 +0000 (18:49 +0000)
Explain why.

winsup/cygwin/ChangeLog
winsup/cygwin/mount.cc

index 09223af..f4c75a3 100644 (file)
@@ -1,5 +1,10 @@
 2009-07-22  Corinna Vinschen  <corinna@vinschen.de>
 
+       * mount.cc (fs_info::update): Open filesystem with access set to 0.
+       Explain why.
+
+2009-07-22  Corinna Vinschen  <corinna@vinschen.de>
+
        * mount.cc: Revert accidental checkin.
 
 2009-07-22  Corinna Vinschen  <corinna@vinschen.de>
index ed1ab90..64583c7 100644 (file)
@@ -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))