Skip to content

Commit

Permalink
kbuild: fixdep: Check fstat(2) return value
Browse files Browse the repository at this point in the history
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: Tom Rini <trini@konsulko.com>
Signed-off-by: Michal Marek <mmarek@suse.com>
  • Loading branch information
Tom Rini authored and Michal Marek committed Feb 17, 2016
1 parent a043934 commit 46fe94a
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion scripts/basic/fixdep.c
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,11 @@ static void do_config_file(const char *filename)
perror(filename);
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) {
close(fd);
return;
Expand Down

0 comments on commit 46fe94a

Please sign in to comment.