Commit 46fe94ad authored by Tom Rini's avatar Tom Rini Committed by Michal Marek

kbuild: fixdep: Check fstat(2) return value

Coverity has recently added a check that will find when we don't check
the return code from fstat(2).  Copy/paste the checking logic that
print_deps() has with an appropriate re-wording of the perror() message.
Signed-off-by: default avatarTom Rini <trini@konsulko.com>
Signed-off-by: default avatarMichal Marek <mmarek@suse.com>
parent a0439342
...@@ -274,7 +274,11 @@ static void do_config_file(const char *filename) ...@@ -274,7 +274,11 @@ static void do_config_file(const char *filename)
perror(filename); perror(filename);
exit(2); exit(2);
} }
fstat(fd, &st); if (fstat(fd, &st) < 0) {
fprintf(stderr, "fixdep: error fstat'ing config file: ");
perror(filename);
exit(2);
}
if (st.st_size == 0) { if (st.st_size == 0) {
close(fd); close(fd);
return; return;
......
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