From 91337da63bfe8f32d84ad5668cd33d0a3ea2f9d8 Mon Sep 17 00:00:00 2001 From: Augustin Cavalier Date: Sat, 23 Oct 2021 13:16:36 -0400 Subject: [PATCH] freebsd_network: Avoid using kernel thread structures in priv_check. We can just use geteuid() here which does the exact same thing. May help with testing #17337. --- src/libs/compat/freebsd_network/priv.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/libs/compat/freebsd_network/priv.cpp b/src/libs/compat/freebsd_network/priv.cpp index 61525ba7e7..e53bc899d1 100644 --- a/src/libs/compat/freebsd_network/priv.cpp +++ b/src/libs/compat/freebsd_network/priv.cpp @@ -4,8 +4,6 @@ */ -#include - #include #include @@ -20,7 +18,7 @@ priv_check(struct thread *thread, int privilegeLevel) // Note: The thread parameter is ignored intentionally (cf. the comment in // pcpu.h). Currently calling this function is only valid for the current // thread. - if (thread_get_current_thread()->team->effective_uid == 0) + if (geteuid() == 0) return ENOERR; return EPERM;