Skip to main content

chmod

Function chmod 

Source
pub async fn chmod(
    prog_track: &'static Progress,
    path: &Path,
    settings: &Settings,
) -> Result<Summary, Error>
Expand description

Public entry point. Applies metadata changes to path and, recursively, its contents. Mirrors crate::rm::rm for the root-filter check.

The walk is fd-based (see crate::safedir): the root operand is opened relative to its parent directory and every entry is classified and mutated through file-descriptor-relative syscalls. A privileged rchm therefore cannot be redirected by a concurrent symlink swap into chmod/chown’ing a target outside the intended tree — the O_NOFOLLOW opens and the inode-pinned O_PATH handles catch the swap and fail closed.