Set O_EXCL when opening file with include_excl #666
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Change Description
When
include_excl
is set, set theO_EXCL
flag. Previously this argument was unused (caught through gcc's unused parameter warning).Rationale
If we have an
include_excl
parameter, it should be respected. However, this does change the default behavior ofFile::open(const char* fileName, File::Mode mode)
, since it defaultsinclude_excl
to true. Becauseinclude_excl
was ignored this effectively is equivalent toinclude_excl
= false.I think the default of not overwriting a file if it already exists is wise. Personally, I believe the value of enforcing this safer default is greater than the impact of breaking projects upgrading to F' 2.0 that implicitly depending on the overwrite on create behavior. However, this is a serious breaking change and it may make sense to keep the current unintentional default and update
File::open(const char* fileName, File::Mode mode)
to set theinclude_excl
flag to false.