diff --git a/OpenFilesScreen.c b/OpenFilesScreen.c
index a312d0f..25b1904 100644
a
|
b
|
static void OpenFilesScreen_draw(OpenFilesScreen* this) { |
76 | 76 | static OpenFiles_ProcessData* OpenFilesScreen_getProcessData(int pid) { |
77 | 77 | char command[1025]; |
78 | 78 | snprintf(command, 1024, "lsof -p %d -F 2> /dev/null", pid); |
| 79 | uid_t euid = geteuid(); |
| 80 | seteuid(getuid()); |
79 | 81 | FILE* fd = popen(command, "r"); |
| 82 | seteuid(euid); |
80 | 83 | OpenFiles_ProcessData* process = calloc(sizeof(OpenFiles_ProcessData), 1); |
| 84 | if (fd) |
| 85 | { |
81 | 86 | OpenFiles_FileData* file = NULL; |
82 | 87 | OpenFiles_ProcessData* item = process; |
83 | 88 | process->failed = true; |
… |
… |
static OpenFiles_ProcessData* OpenFilesScreen_getProcessData(int pid) { |
107 | 112 | item->data[cmd] = entry; |
108 | 113 | } |
109 | 114 | pclose(fd); |
| 115 | } |
110 | 116 | return process; |
111 | 117 | } |
112 | 118 | |
diff --git a/Process.c b/Process.c
index cd9a887..42c4fe0 100644
a
|
b
|
Process_toggleTag( Process * this ) { |
587 | 587 | |
588 | 588 | bool |
589 | 589 | Process_setPriority( Process * this, int priority ) { |
590 | | int old_prio = getpriority( PRIO_PROCESS, this->pid ); |
591 | | int err = setpriority( PRIO_PROCESS, this->pid, priority ); |
592 | | if ( err == 0 && old_prio != getpriority( PRIO_PROCESS, this->pid ) ) { |
593 | | this->nice = priority; |
| 590 | if ( Process_getuid == 0 || Process_getuid == this->st_uid ) { |
| 591 | int old_prio = getpriority( PRIO_PROCESS, this->pid ); |
| 592 | int err = setpriority( PRIO_PROCESS, this->pid, priority ); |
| 593 | if ( err == 0 && old_prio != getpriority( PRIO_PROCESS, this->pid ) ) { |
| 594 | this->nice = priority; |
| 595 | } |
| 596 | return ( err == 0 ); |
594 | 597 | } |
595 | | return ( err == 0 ); |
| 598 | else |
| 599 | return false; |
596 | 600 | } |
597 | 601 | |
598 | 602 | unsigned long |
… |
… |
Process_setAffinity( Process * this, unsigned long mask ) { |
607 | 611 | |
608 | 612 | void |
609 | 613 | Process_sendSignal( Process * this, int signal ) { |
610 | | kill( this->pid, signal ); |
| 614 | if ( Process_getuid == 0 || Process_getuid == this->st_uid ) |
| 615 | kill( this->pid, signal ); |
611 | 616 | } |
612 | 617 | |
613 | 618 | int |
diff --git a/TraceScreen.c b/TraceScreen.c
index 19254f9..0fd86b6 100644
a
|
b
|
void TraceScreen_run(TraceScreen* this) { |
70 | 70 | int child = fork(); |
71 | 71 | if (child == -1) return; |
72 | 72 | if (child == 0) { |
| 73 | seteuid(getuid()); |
73 | 74 | dup2(fdpair[1], STDERR_FILENO); |
74 | 75 | fcntl(fdpair[1], F_SETFL, O_NONBLOCK); |
75 | 76 | sprintf(buffer, "%d", this->process->pid); |