Merge pull request #14190 from Dentomologist/directiofile_dont_request_delete_access_for_read_only_open

Windows/DirectIOFile: Don't request DELETE access for read-only Open
This commit is contained in:
Jordan Woyak authored and GitHub committed 2025-11-29 16:23:31 -06:00
commit 59d5e25f5f
1 file changed
+5 -2
+5 -2
View File
@@ -86,8 +86,11 @@ bool DirectIOFile::Open(const std::string& path, AccessMode access_mode, OpenMod
else if (access_mode == AccessMode::Write) else if (access_mode == AccessMode::Write)
desired_access = GENERIC_WRITE; desired_access = GENERIC_WRITE;
// Allow deleting and renaming through our handle. if (access_mode != AccessMode::Read)
desired_access |= DELETE; {
// Allow deleting and renaming through our handle.
desired_access |= DELETE;
}
// All sharing is allowed to more closely match default behavior on other OSes. // All sharing is allowed to more closely match default behavior on other OSes.
constexpr DWORD share_mode = FILE_SHARE_DELETE | FILE_SHARE_READ | FILE_SHARE_WRITE; constexpr DWORD share_mode = FILE_SHARE_DELETE | FILE_SHARE_READ | FILE_SHARE_WRITE;