Skip to content

Commit

Permalink
Fix ignore return value warnings
Browse files Browse the repository at this point in the history
Closes #30
  • Loading branch information
nowrep committed Apr 18, 2024
1 parent 7a2b191 commit ed9df10
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions main.c
Original file line number Diff line number Diff line change
Expand Up @@ -996,7 +996,9 @@ static void run_sh_command(const char *command, const char *serial_number)
}
if (pid == 0) {
setenv("DS_DEV", serial_number, 1);
system(command);
if (system(command) < 0) {
perror("system");
}
exit(1);
} else if (pid < 0) {
perror("fork");
Expand All @@ -1018,7 +1020,9 @@ static uint32_t read_file_hex(const char *path)
if (!f) {
return out;
}
fscanf(f, "%x", &out);
if (fscanf(f, "%x", &out) != 1) {
fprintf(stderr, "Failed to read %s\n", path);
}
fclose(f);
return out;
}
Expand All @@ -1029,7 +1033,9 @@ static void read_file_str(const char *path, char *buf, size_t size)
if (!f) {
return;
}
fread(buf, size, 1, f);
if (fread(buf, size, 1, f) != 1) {
fprintf(stderr, "Failed to read %s\n", path);
}
buf[size - 1] = '\0';
fclose(f);
}
Expand Down

0 comments on commit ed9df10

Please sign in to comment.