From 72bc20c99bcc137c22be932ab584556098ff930e Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Fri, 26 Aug 2022 11:44:05 +0100 Subject: [PATCH] arti: running_as_setuid: fix MacOs build libc::getuid and geteuid are marked unsafe, even though I think they could be safe. So the previous code didn't build. --- crates/arti-client/src/util.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/arti-client/src/util.rs b/crates/arti-client/src/util.rs index d00048986..b78612862 100644 --- a/crates/arti-client/src/util.rs +++ b/crates/arti-client/src/util.rs @@ -79,8 +79,8 @@ pub(crate) fn running_as_setuid() -> bool { // We "sort of" ignore failures: in each case, we insist that both calls succeed, // giving the same answer, or both calls fail. This ought to work well enough. - let same_reuid = libc::geteuid() == libc::getuid(); - let same_regid = libc::getegid() == libc::getgid(); + let same_reuid = unsafe { libc::geteuid() == libc::getuid() }; + let same_regid = unsafe { libc::getegid() == libc::getgid() }; !(same_reuid && same_regid) } }