Skip to content

Commit

Permalink
Expand std::os::unix::fs::chown() doc with a warning
Browse files Browse the repository at this point in the history
Include warning about losing setuid/gid when chowning, per POSIX.
  • Loading branch information
grinapo authored and gitbot committed Feb 20, 2025
1 parent 9aee14e commit d0226cf
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions std/src/os/unix/fs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -986,6 +986,10 @@ impl DirBuilderExt for fs::DirBuilder {
/// Changing the owner typically requires privileges, such as root or a specific capability.
/// Changing the group typically requires either being the owner and a member of the group, or
/// having privileges.
///
/// Be aware that changing owner clears the `suid` and `sgid` permission bits in most cases
/// according to POSIX, usually even if the user is root. The sgid is not cleared when
/// the file is non-group-executable.
///
/// If called on a symbolic link, this will change the owner and group of the link target. To
/// change the owner and group of the link itself, see [`lchown`].
Expand Down

0 comments on commit d0226cf

Please sign in to comment.