mirror of
https://github.com/xzeldon/htop.git
synced 2025-07-13 04:34:35 +03:00
add some security checks when running SUID root
on Darwin, htop needs to run with root privileges to display information about other users processes. This commit makes running htop SUID root a bit more safe.
This commit is contained in:
@ -86,6 +86,7 @@ void TraceScreen_run(TraceScreen* this) {
|
||||
int child = fork();
|
||||
if (child == -1) return;
|
||||
if (child == 0) {
|
||||
seteuid(getuid());
|
||||
dup2(fdpair[1], STDERR_FILENO);
|
||||
int ok = fcntl(fdpair[1], F_SETFL, O_NONBLOCK);
|
||||
if (ok != -1) {
|
||||
|
Reference in New Issue
Block a user