about summary refs log tree commit diff
path: root/library/std/src
diff options
context:
space:
mode:
authorPeter Gervai <grinapo@gmail.com>2024-08-22 14:29:57 +0200
committerGitHub <noreply@github.com>2024-08-22 14:29:57 +0200
commita9ecd0fa8141e7614ca35d5a4d2fe5c96b1a7890 (patch)
tree5234bb4a700717db69a25f2f38d1930c94cf875d /library/std/src
parent8269be147b13812c201d0b64966adc1c6536ca59 (diff)
downloadrust-a9ecd0fa8141e7614ca35d5a4d2fe5c96b1a7890.tar.gz
rust-a9ecd0fa8141e7614ca35d5a4d2fe5c96b1a7890.zip
Expand std::os::unix::fs::chown() doc with a warning
Include warning about losing setuid/gid when chowning, per POSIX.
Diffstat (limited to 'library/std/src')
-rw-r--r--library/std/src/os/unix/fs.rs4
1 files changed, 4 insertions, 0 deletions
diff --git a/library/std/src/os/unix/fs.rs b/library/std/src/os/unix/fs.rs
index caf6980afd9..f063fa06cc9 100644
--- a/library/std/src/os/unix/fs.rs
+++ b/library/std/src/os/unix/fs.rs
@@ -985,6 +985,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`].