We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
SAFETY
getuid
1 parent 1e3c8f1 commit d1a1e1cCopy full SHA for d1a1e1c
src/bootstrap/lib.rs
@@ -368,6 +368,10 @@ impl Build {
368
// https://github.com/rust-lang/rust/blob/a8a33cf27166d3eabaffc58ed3799e054af3b0c6/src/bootstrap/bootstrap.py#L796-L797
369
let is_sudo = match env::var_os("SUDO_USER") {
370
Some(_sudo_user) => {
371
+ // SAFETY: getuid() system calls are always successful, and no return value is reserved
372
+ // to indicate an error.
373
+ //
374
+ // For more context, see https://man7.org/linux/man-pages/man2/geteuid.2.html
375
let uid = unsafe { libc::getuid() };
376
uid == 0
377
}
0 commit comments