diff options
author | Graham Inggs <ginggs@debian.org> | 2018-02-05 14:48:51 +0200 |
---|---|---|
committer | Graham Inggs <ginggs@debian.org> | 2018-02-05 14:48:51 +0200 |
commit | 2ee50d030178cede83eb9d0005fbc19f819d30fe (patch) | |
tree | 67d75c0a7c47e15bed9d0735ecf12abec4f8157b /TraceScreen.c | |
parent | 31b71b67011fa52f091df6fe536a11d6d0bfb256 (diff) | |
download | debian_htop-2ee50d030178cede83eb9d0005fbc19f819d30fe.tar.gz debian_htop-2ee50d030178cede83eb9d0005fbc19f819d30fe.tar.bz2 debian_htop-2ee50d030178cede83eb9d0005fbc19f819d30fe.zip |
Imported Upstream version 2.1.0upstream/2.1.0
Diffstat (limited to 'TraceScreen.c')
-rw-r--r-- | TraceScreen.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/TraceScreen.c b/TraceScreen.c index 2d6eb33..abef712 100644 --- a/TraceScreen.c +++ b/TraceScreen.c @@ -22,6 +22,7 @@ in the source distribution for its full text. #include <stdbool.h> #include <unistd.h> #include <fcntl.h> +#include <sys/time.h> #include <sys/types.h> #include <sys/wait.h> #include <signal.h> @@ -42,9 +43,9 @@ typedef struct TraceScreen_ { }*/ -static const char* TraceScreenFunctions[] = {"Search ", "Filter ", "AutoScroll ", "Stop Tracing ", "Done ", NULL}; +static const char* const TraceScreenFunctions[] = {"Search ", "Filter ", "AutoScroll ", "Stop Tracing ", "Done ", NULL}; -static const char* TraceScreenKeys[] = {"F3", "F4", "F8", "F9", "Esc"}; +static const char* const TraceScreenKeys[] = {"F3", "F4", "F8", "F9", "Esc"}; static int TraceScreenEvents[] = {KEY_F(3), KEY_F(4), KEY_F(8), KEY_F(9), 27}; @@ -90,16 +91,16 @@ void TraceScreen_draw(InfoScreen* this) { bool TraceScreen_forkTracer(TraceScreen* this) { char buffer[1001]; - int err = pipe(this->fdpair); - if (err == -1) return false; + int error = pipe(this->fdpair); + if (error == -1) return false; this->child = fork(); if (this->child == -1) return false; if (this->child == 0) { - (void) seteuid(getuid()); + CRT_dropPrivileges(); dup2(this->fdpair[1], STDERR_FILENO); int ok = fcntl(this->fdpair[1], F_SETFL, O_NONBLOCK); if (ok != -1) { - sprintf(buffer, "%d", this->super.process->pid); + xSnprintf(buffer, sizeof(buffer), "%d", this->super.process->pid); execlp("strace", "strace", "-p", buffer, NULL); } const char* message = "Could not execute 'strace'. Please make sure it is available in your $PATH."; |