summaryrefslogtreecommitdiffstats
path: root/TraceScreen.c
diff options
context:
space:
mode:
authorMichael Klein <michael.klein@puffin.lb.shuttle.de>2015-12-02 22:15:46 +0100
committerMichael Klein <michael.klein@puffin.lb.shuttle.de>2015-12-02 22:56:01 +0100
commitd18e9a4895599a479df264a6c7380b8805abb434 (patch)
tree27d10678f5540f7e3a760dbce92365edd52e7f10 /TraceScreen.c
parent670a2de6921e00e4768375b2636fa94e5ce663fd (diff)
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.
Diffstat (limited to 'TraceScreen.c')
-rw-r--r--TraceScreen.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/TraceScreen.c b/TraceScreen.c
index ecd0c0ab..3a62eb63 100644
--- a/TraceScreen.c
+++ b/TraceScreen.c
@@ -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) {

© 2014-2024 Faster IT GmbH | imprint | privacy policy