From 95a12e0ee87a3c1dba806889373ce418f46c7591 Mon Sep 17 00:00:00 2001 From: Thad House Date: Mon, 13 Sep 2021 21:08:39 -0700 Subject: [PATCH] [hal] UidSetter: Don't revert euid if its already current value (#3566) When running from admin account, this hangs for 5-10 seconds. Co-authored-by: Tyler Veness --- hal/src/main/native/athena/Threads.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hal/src/main/native/athena/Threads.cpp b/hal/src/main/native/athena/Threads.cpp index d60b2800a7..f7afa91992 100644 --- a/hal/src/main/native/athena/Threads.cpp +++ b/hal/src/main/native/athena/Threads.cpp @@ -31,7 +31,7 @@ class UidSetter { } ~UidSetter() noexcept(false) { - if (seteuid(m_uid) == -1) { + if (geteuid() != m_uid && seteuid(m_uid) == -1) { throw std::system_error(errno, std::generic_category(), fmt::format("seteuid({}) failed", m_uid)); }