Skip to content

Commit 48fb1bb

Browse files
grinapogitbot
authored and
gitbot
committed
Expand std::os::unix::fs::chown() doc with a warning
Include warning about losing setuid/gid when chowning, per POSIX.
1 parent b4015bd commit 48fb1bb

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

std/src/os/unix/fs.rs

+4
Original file line numberDiff line numberDiff line change
@@ -986,6 +986,10 @@ impl DirBuilderExt for fs::DirBuilder {
986986
/// Changing the owner typically requires privileges, such as root or a specific capability.
987987
/// Changing the group typically requires either being the owner and a member of the group, or
988988
/// having privileges.
989+
///
990+
/// Be aware that changing owner clears the `suid` and `sgid` permission bits in most cases
991+
/// according to POSIX, usually even if the user is root. The sgid is not cleared when
992+
/// the file is non-group-executable.
989993
///
990994
/// If called on a symbolic link, this will change the owner and group of the link target. To
991995
/// change the owner and group of the link itself, see [`lchown`].

0 commit comments

Comments
 (0)