diff --git a/hal/src/main/native/athena/Threads.cpp b/hal/src/main/native/athena/Threads.cpp index f7afa91992..aa55b56945 100644 --- a/hal/src/main/native/athena/Threads.cpp +++ b/hal/src/main/native/athena/Threads.cpp @@ -6,42 +6,9 @@ #include #include -#include - -#include -#include -#include - -#include #include "hal/Errors.h" -namespace { -class UidSetter { - public: - explicit UidSetter(uid_t uid) { - m_uid = geteuid(); - if (uid == 0 && setuid(uid) == -1) { - throw std::system_error(errno, std::generic_category(), - fmt::format("setuid({}) failed", uid)); - } else if (uid != 0 && seteuid(uid) == -1) { - throw std::system_error(errno, std::generic_category(), - fmt::format("seteuid({}) failed", uid)); - } - } - - ~UidSetter() noexcept(false) { - if (geteuid() != m_uid && seteuid(m_uid) == -1) { - throw std::system_error(errno, std::generic_category(), - fmt::format("seteuid({}) failed", m_uid)); - } - } - - private: - uid_t m_uid; -}; -} // namespace - namespace hal::init { void InitializeThreads() {} } // namespace hal::init @@ -104,20 +71,13 @@ HAL_Bool HAL_SetThreadPriority(NativeThreadHandle handle, HAL_Bool realTime, sch.sched_priority = 0; } - try { - UidSetter uidSetter{0}; - - if (pthread_setschedparam(*reinterpret_cast(handle), - scheduler, &sch)) { - *status = HAL_THREAD_PRIORITY_ERROR; - return false; - } else { - *status = 0; - return true; - } - } catch (const std::system_error& e) { - *status = HAL_SETUID_ERROR; + if (pthread_setschedparam(*reinterpret_cast(handle), + scheduler, &sch)) { + *status = HAL_THREAD_PRIORITY_ERROR; return false; + } else { + *status = 0; + return true; } } diff --git a/hal/src/main/native/include/hal/Errors.h b/hal/src/main/native/include/hal/Errors.h index 724a60c19d..5da75d956c 100644 --- a/hal/src/main/native/include/hal/Errors.h +++ b/hal/src/main/native/include/hal/Errors.h @@ -135,9 +135,6 @@ #define HAL_USE_LAST_ERROR_MESSAGE \ "HAL: Use HAL_GetLastError(status) to get last error" -#define HAL_SETUID_ERROR -1157 -#define HAL_SETUID_ERROR_MESSAGE "HAL: Setting the effective user ID has failed" - #define HAL_CAN_BUFFER_OVERRUN -35007 #define HAL_CAN_BUFFER_OVERRUN_MESSAGE \ "HAL: CAN Output Buffer Full. Ensure a device is attached"