Commit 08829cbc authored by Christian Hesse's avatar Christian Hesse
Browse files

fix compiler warnings

gcc gives warnings like this:

warning: ignoring return value of ‘fscanf’, declared with attribute
warn_unused_result

Assign value to a variable, cast to (void) to discard it.
parent f4f6d54f
...@@ -93,7 +93,8 @@ void TraceScreen_run(TraceScreen* this) { ...@@ -93,7 +93,8 @@ void TraceScreen_run(TraceScreen* this) {
execlp("strace", "strace", "-p", buffer, NULL); execlp("strace", "strace", "-p", buffer, NULL);
} }
const char* message = "Could not execute 'strace'. Please make sure it is available in your $PATH."; const char* message = "Could not execute 'strace'. Please make sure it is available in your $PATH.";
write(fdpair[1], message, strlen(message)); ssize_t written = write(fdpair[1], message, strlen(message));
(void) written;
exit(1); exit(1);
} }
fcntl(fdpair[0], F_SETFL, O_NONBLOCK); fcntl(fdpair[0], F_SETFL, O_NONBLOCK);
......
...@@ -94,7 +94,8 @@ ProcessList* ProcessList_new(UsersTable* usersTable, Hashtable* pidWhiteList, ui ...@@ -94,7 +94,8 @@ ProcessList* ProcessList_new(UsersTable* usersTable, Hashtable* pidWhiteList, ui
int cpus = -1; int cpus = -1;
do { do {
cpus++; cpus++;
fgets(buffer, 255, file); char * s = fgets(buffer, 255, file);
(void) s;
} while (String_startsWith(buffer, "cpu")); } while (String_startsWith(buffer, "cpu"));
fclose(file); fclose(file);
......
...@@ -110,7 +110,8 @@ int Platform_getMaxPid() { ...@@ -110,7 +110,8 @@ int Platform_getMaxPid() {
FILE* file = fopen(PROCDIR "/sys/kernel/pid_max", "r"); FILE* file = fopen(PROCDIR "/sys/kernel/pid_max", "r");
if (!file) return -1; if (!file) return -1;
int maxPid = 4194303; int maxPid = 4194303;
(void) fscanf(file, "%32d", &maxPid); int match = fscanf(file, "%32d", &maxPid);
(void) match;
fclose(file); fclose(file);
return maxPid; return maxPid;
} }
......
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