History

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.

Tom Rini committed 10 years ago

Commit 46fe94a1 parent a0439341 file · +5 −1Browse files

Showing the changes to scripts/basic (1 of 1 file). Show all

Unified · Split

scripts/basic/fixdep.c+5−1
@@ -274,7 +274,11 @@ static void do_config_file(const char *filename) · 273 unmodified lines
274274 perror(filename);
275275 exit(2);
276276 }
277− fstat(fd, &st);
277+ if (fstat(fd, &st) < 0) {
278+ fprintf(stderr, "fixdep: error fstat'ing config file: ");
279+ perror(filename);
280+ exit(2);
281+ }
278282 if (st.st_size == 0) {
279283 close(fd);
280284 return;

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t