Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mmap_file_iterator uses too restrictive sharing mode in a call to CreateFileA #778

Open
mikekaganski opened this issue Dec 1, 2023 · 0 comments

Comments

@mikekaganski
Copy link

explicit mmap_file_iterator(std::string const& fileName)

CreateFileA call uses FILE_SHARE_READ as sharing mode. This makes this call fail, when the file is already open for writing, as explained at https://learn.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-createfilea#parameters (see dwShareMode).

To allow opening files for reading, even when another process has it open for writing, but explicitly allowed reading using its own FILE_SHARE_READ, this call needs to use FILE_SHARE_READ | FILE_SHARE_WRITE (and maybe even also | FILE_SHARE_DELETE).

https://bugs.documentfoundation.org/show_bug.cgi?id=158442 was caused by this problem (fixed by patching spirit).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant