Function nix::unistd::fchownat

source ·
pub fn fchownat<Fd: AsFd, P: ?Sized + NixPath>(
    dirfd: Fd,
    path: &P,
    owner: Option<Uid>,
    group: Option<Gid>,
    flag: AtFlags,
) -> Result<()>
Expand description

Change the ownership of the file at path to be owned by the specified owner (user) and group.

The owner/group for the provided path name will not be modified if None is provided for that argument. Ownership change will be attempted for the path only if Some owner/group is provided.

If flag is AtFlags::AT_SYMLINK_NOFOLLOW and path names a symbolic link, then the mode of the symbolic link is changed.

fchownat(AT_FDCWD, path, owner, group, AtFlags::AT_SYMLINK_NOFOLLOW) is identical to a call libc::lchown(path, owner, group). That’s why lchown is unimplemented in the nix crate.

§References

fchownat(2).