fcopy(): Add function, and use it instead of its pattern#1499
Draft
alejandro-colomar wants to merge 3 commits intoshadow-maint:masterfrom
Draft
fcopy(): Add function, and use it instead of its pattern#1499alejandro-colomar wants to merge 3 commits intoshadow-maint:masterfrom
alejandro-colomar wants to merge 3 commits intoshadow-maint:masterfrom
Conversation
f4c01e9 to
9ce666a
Compare
27d3806 to
8f22b1d
Compare
…to another We could probably implement this more efficiently, but this is simple and works. It is based on code from lib/commonio.c:create_backup(). Verify that the destination file is empty before writing to it. All callers have an empty file, but being a generic API, let's verify anyway. If we didn't verify, and the file was larger than the source file, then we'd end up with a mix of the old and new contents. Signed-off-by: Alejandro Colomar <alx@kernel.org>
No changes intended. Signed-off-by: Alejandro Colomar <alx@kernel.org>
This is consistent with fmkstemp_set_perms() in lib/commonio.c. This avoids accidentally granting dangerous permissions. Closes: <shadow-maint#1500> Reported-by: Alejandro Colomar <alx@kernel.org> Suggested-by: Tobias Stoeckmann <tobias@stoeckmann.org> Signed-off-by: Alejandro Colomar <alx@kernel.org>
8f22b1d to
4049e39
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Cc: @stoeckmann
Revisions:
v1b
v2
v2b
v2c
v2d