- --chmod no longer implies --preserve-perms; repeated --chmod options accumulate, and D/F/X selectors plus s/t special bits are supported with rsync's exact parse_chmod/tweak_mode semantics. - Stop masking group/other write and setuid/setgid/sticky: -p copies the source mode exactly, no-p new entries use source&~umask, directories keep setgid/sticky, and special nodes follow the same rules. - Apply ownership before mode on the fd path so a chown cannot clear the setuid/setgid bits -p just restored (rsync order). - Update unit and integration tests, including differential checks against rsync 3.4.1.
14 lines
461 B
C
14 lines
461 B
C
#ifndef CHMOD_H
|
|
#define CHMOD_H
|
|
|
|
#include <stdbool.h>
|
|
#include <sys/stat.h>
|
|
|
|
/* Apply rsync's --chmod syntax to a permission mode, including the D/F/X
|
|
* selectors and the s/t special bits. `mode` should carry the file type bits
|
|
* (S_IFDIR/S_IFREG) so D/F/X can be evaluated; the type bits are preserved in
|
|
* `result`. A spec may contain comma-separated clauses, which accumulate. */
|
|
bool chmod_apply(mode_t mode, const char* spec, mode_t* result);
|
|
|
|
#endif
|