mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 00:57:45 +00:00
SystemMonitor: Use kill(pid,0) when checking for kill permission
We can use kill(pid,0) to check for kill permissions instead of relying on file path access. Using 0 as signal does error checking but does not send a signal.
This commit is contained in:
parent
6aa2b7d4cc
commit
5fbb476856
1 changed files with 2 additions and 2 deletions
|
@ -87,8 +87,8 @@ private:
|
||||||
|
|
||||||
static bool can_access_pid(pid_t pid)
|
static bool can_access_pid(pid_t pid)
|
||||||
{
|
{
|
||||||
auto path = String::formatted("/proc/{}", pid);
|
int rc = kill(pid, 0);
|
||||||
return access(path.characters(), X_OK) == 0;
|
return rc == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, char** argv)
|
int main(int argc, char** argv)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue