diff --git a/native/src/core/deny/utils.cpp b/native/src/core/deny/utils.cpp index 64e175622..8173934ed 100644 --- a/native/src/core/deny/utils.cpp +++ b/native/src/core/deny/utils.cpp @@ -10,6 +10,7 @@ #include #include #include +#include #include "deny.hpp" @@ -108,12 +109,11 @@ static bool proc_name_match(int pid, string_view name) { bool proc_context_match(int pid, string_view context) { char buf[PATH_MAX]; - sprintf(buf, "/proc/%d/attr/current", pid); - if (auto fp = open_file(buf, "re")) { - fgets(buf, sizeof(buf), fp.get()); - if (str_starts(buf, context)) { - return true; - } + char con[1024]; + + sprintf(buf, "/proc/%d", pid); + if (lgetfilecon(buf, { con, sizeof(con) }) >= 0) { + return str_starts(con, context); } return false; }