-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
[copy_file] allow FILE_SHARE_*
#2718
Conversation
The existing code does not allow other programs to hold read permissions on _Source or _Target when copy_options = overwrite_existing or skip_existing. We could very easily allow reading, and could also allow writing for skip_existing, except for a clever implementation of equivalent, so just switch to a dumb implementation of equivalent here.
FILE_SHARE_*
return _Last_error; // real error, bail to the caller | ||
} | ||
|
||
#ifndef _CRT_APP |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we simplify the else case to simply be return __std_win_error{...}
and move the switch into here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is pre-existing code that's being extracted from __std_fs_get_file_id()
. I see what you're suggesting, and the control flow transformation wouldn't be risky, but my general preference is to avoid significantly altering code when moving it (unless it's necessary). We can do this as a followup cleanup, since this doesn't affect correctness or performance.
I'm mirroring this to the MSVC-internal repo - please notify me if any further changes are pushed. |
Thanks for teaching the STL how to play nice and share! 😹 📂 🎉 |
Co-authored-by: nicole mazzuca <[email protected]>
The existing code does not allow other programs to hold read permissions
on
_Source
or_Target
whencopy_options = overwrite_existing or skip_existing.
We could very easily allow reading, and could also allow writing for
skip_existing, except for a clever implementation of equivalent,
so just switch to a dumb implementation of equivalent here.
Fixes #2185