dchmod: fix check for CAP_CHOWN and CAP_FOWNER capabilities #562
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.
While adding the
--open-noatime
feature, it was discovered thatmfu_flist_chmod
was incorrectly checking forCAP_CHOWN
andCAP_FOWNER
capabilities. The old check would have reported that a process had such capabilities when it did not. This changes things to delegate the check to the newmfu_proc_set()
function that was added for--open-noatime
.By default,
mfu_flist_chmod
should avoid trying to change the group or permissions of files that the current user does not own. However, due to wrong info about capabilities, it attempts the change and then reports an error:With the fix, it now detects that it does not have permission to make the change, and so it correctly skips those files.
The end result is that dchmod prints fewer error messages when normal users change group or permission bits on a directory tree that contains files from a mix of different users. If needed, one can still force
dchmod
to attempt the change with--force
.