mirror of https://github.com/xzeldon/htop.git
parent
b7ac416634
commit
fa0c637c55
|
@ -49,9 +49,9 @@ void EnvScreen_scan(InfoScreen* this) {
|
||||||
Panel_prune(panel);
|
Panel_prune(panel);
|
||||||
|
|
||||||
uid_t euid = geteuid();
|
uid_t euid = geteuid();
|
||||||
seteuid(getuid());
|
(void) seteuid(getuid());
|
||||||
char *env = Platform_getProcessEnv(this->process->pid);
|
char *env = Platform_getProcessEnv(this->process->pid);
|
||||||
seteuid(euid);
|
(void) seteuid(euid);
|
||||||
if (env) {
|
if (env) {
|
||||||
for (char *p = env; *p; p = strrchr(p, 0)+1)
|
for (char *p = env; *p; p = strrchr(p, 0)+1)
|
||||||
InfoScreen_addLine(this, p);
|
InfoScreen_addLine(this, p);
|
||||||
|
|
|
@ -518,10 +518,10 @@ void Process_toggleTag(Process* this) {
|
||||||
|
|
||||||
bool Process_setPriority(Process* this, int priority) {
|
bool Process_setPriority(Process* this, int priority) {
|
||||||
uid_t euid = geteuid();
|
uid_t euid = geteuid();
|
||||||
seteuid(getuid());
|
(void) seteuid(getuid());
|
||||||
int old_prio = getpriority(PRIO_PROCESS, this->pid);
|
int old_prio = getpriority(PRIO_PROCESS, this->pid);
|
||||||
int err = setpriority(PRIO_PROCESS, this->pid, priority);
|
int err = setpriority(PRIO_PROCESS, this->pid, priority);
|
||||||
seteuid(euid);
|
(void) seteuid(euid);
|
||||||
if (err == 0 && old_prio != getpriority(PRIO_PROCESS, this->pid)) {
|
if (err == 0 && old_prio != getpriority(PRIO_PROCESS, this->pid)) {
|
||||||
this->nice = priority;
|
this->nice = priority;
|
||||||
}
|
}
|
||||||
|
@ -534,9 +534,9 @@ bool Process_changePriorityBy(Process* this, size_t delta) {
|
||||||
|
|
||||||
void Process_sendSignal(Process* this, size_t sgn) {
|
void Process_sendSignal(Process* this, size_t sgn) {
|
||||||
uid_t euid = geteuid();
|
uid_t euid = geteuid();
|
||||||
seteuid(getuid());
|
(void) seteuid(getuid());
|
||||||
kill(this->pid, (int) sgn);
|
kill(this->pid, (int) sgn);
|
||||||
seteuid(euid);
|
(void) seteuid(euid);
|
||||||
}
|
}
|
||||||
|
|
||||||
long Process_pidCompare(const void* v1, const void* v2) {
|
long Process_pidCompare(const void* v1, const void* v2) {
|
||||||
|
|
12
Settings.c
12
Settings.c
|
@ -167,9 +167,9 @@ static bool Settings_read(Settings* this, const char* fileName) {
|
||||||
FILE* fd;
|
FILE* fd;
|
||||||
uid_t euid = geteuid();
|
uid_t euid = geteuid();
|
||||||
|
|
||||||
seteuid(getuid());
|
(void) seteuid(getuid());
|
||||||
fd = fopen(fileName, "r");
|
fd = fopen(fileName, "r");
|
||||||
seteuid(euid);
|
(void) seteuid(euid);
|
||||||
if (!fd)
|
if (!fd)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
@ -277,9 +277,9 @@ bool Settings_write(Settings* this) {
|
||||||
FILE* fd;
|
FILE* fd;
|
||||||
uid_t euid = geteuid();
|
uid_t euid = geteuid();
|
||||||
|
|
||||||
seteuid(getuid());
|
(void) seteuid(getuid());
|
||||||
fd = fopen(this->filename, "w");
|
fd = fopen(this->filename, "w");
|
||||||
seteuid(euid);
|
(void) seteuid(euid);
|
||||||
if (fd == NULL) {
|
if (fd == NULL) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -366,7 +366,7 @@ Settings* Settings_new(int cpuCount) {
|
||||||
}
|
}
|
||||||
legacyDotfile = String_cat(home, "/.htoprc");
|
legacyDotfile = String_cat(home, "/.htoprc");
|
||||||
uid_t euid = geteuid();
|
uid_t euid = geteuid();
|
||||||
seteuid(getuid());
|
(void) seteuid(getuid());
|
||||||
(void) mkdir(configDir, 0700);
|
(void) mkdir(configDir, 0700);
|
||||||
(void) mkdir(htopDir, 0700);
|
(void) mkdir(htopDir, 0700);
|
||||||
free(htopDir);
|
free(htopDir);
|
||||||
|
@ -379,7 +379,7 @@ Settings* Settings_new(int cpuCount) {
|
||||||
free(legacyDotfile);
|
free(legacyDotfile);
|
||||||
legacyDotfile = NULL;
|
legacyDotfile = NULL;
|
||||||
}
|
}
|
||||||
seteuid(euid);
|
(void) seteuid(euid);
|
||||||
}
|
}
|
||||||
this->colorScheme = 0;
|
this->colorScheme = 0;
|
||||||
this->changed = false;
|
this->changed = false;
|
||||||
|
|
|
@ -95,7 +95,7 @@ bool TraceScreen_forkTracer(TraceScreen* this) {
|
||||||
this->child = fork();
|
this->child = fork();
|
||||||
if (this->child == -1) return false;
|
if (this->child == -1) return false;
|
||||||
if (this->child == 0) {
|
if (this->child == 0) {
|
||||||
seteuid(getuid());
|
(void) seteuid(getuid());
|
||||||
dup2(this->fdpair[1], STDERR_FILENO);
|
dup2(this->fdpair[1], STDERR_FILENO);
|
||||||
int ok = fcntl(this->fdpair[1], F_SETFL, O_NONBLOCK);
|
int ok = fcntl(this->fdpair[1], F_SETFL, O_NONBLOCK);
|
||||||
if (ok != -1) {
|
if (ok != -1) {
|
||||||
|
|
Loading…
Reference in New Issue