Commit fa0c637c authored by Hisham's avatar Hisham
Browse files

Silence warnings about seteuid return value.

Closes #483.
parent b7ac4166
......@@ -49,9 +49,9 @@ void EnvScreen_scan(InfoScreen* this) {
Panel_prune(panel);
uid_t euid = geteuid();
seteuid(getuid());
(void) seteuid(getuid());
char *env = Platform_getProcessEnv(this->process->pid);
seteuid(euid);
(void) seteuid(euid);
if (env) {
for (char *p = env; *p; p = strrchr(p, 0)+1)
InfoScreen_addLine(this, p);
......
......@@ -518,10 +518,10 @@ void Process_toggleTag(Process* this) {
bool Process_setPriority(Process* this, int priority) {
uid_t euid = geteuid();
seteuid(getuid());
(void) seteuid(getuid());
int old_prio = getpriority(PRIO_PROCESS, this->pid);
int err = setpriority(PRIO_PROCESS, this->pid, priority);
seteuid(euid);
(void) seteuid(euid);
if (err == 0 && old_prio != getpriority(PRIO_PROCESS, this->pid)) {
this->nice = priority;
}
......@@ -534,9 +534,9 @@ bool Process_changePriorityBy(Process* this, size_t delta) {
void Process_sendSignal(Process* this, size_t sgn) {
uid_t euid = geteuid();
seteuid(getuid());
(void) seteuid(getuid());
kill(this->pid, (int) sgn);
seteuid(euid);
(void) seteuid(euid);
}
long Process_pidCompare(const void* v1, const void* v2) {
......
......@@ -167,9 +167,9 @@ static bool Settings_read(Settings* this, const char* fileName) {
FILE* fd;
uid_t euid = geteuid();
seteuid(getuid());
(void) seteuid(getuid());
fd = fopen(fileName, "r");
seteuid(euid);
(void) seteuid(euid);
if (!fd)
return false;
......@@ -277,9 +277,9 @@ bool Settings_write(Settings* this) {
FILE* fd;
uid_t euid = geteuid();
seteuid(getuid());
(void) seteuid(getuid());
fd = fopen(this->filename, "w");
seteuid(euid);
(void) seteuid(euid);
if (fd == NULL) {
return false;
}
......@@ -366,7 +366,7 @@ Settings* Settings_new(int cpuCount) {
}
legacyDotfile = String_cat(home, "/.htoprc");
uid_t euid = geteuid();
seteuid(getuid());
(void) seteuid(getuid());
(void) mkdir(configDir, 0700);
(void) mkdir(htopDir, 0700);
free(htopDir);
......@@ -379,7 +379,7 @@ Settings* Settings_new(int cpuCount) {
free(legacyDotfile);
legacyDotfile = NULL;
}
seteuid(euid);
(void) seteuid(euid);
}
this->colorScheme = 0;
this->changed = false;
......
......@@ -95,7 +95,7 @@ bool TraceScreen_forkTracer(TraceScreen* this) {
this->child = fork();
if (this->child == -1) return false;
if (this->child == 0) {
seteuid(getuid());
(void) seteuid(getuid());
dup2(this->fdpair[1], STDERR_FILENO);
int ok = fcntl(this->fdpair[1], F_SETFL, O_NONBLOCK);
if (ok != -1) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment