diff options
author | Tom Rini <trini@konsulko.com> | 2016-05-13 17:54:04 +0300 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2016-05-23 18:50:21 +0300 |
commit | c1420f8b2b0f3c833c024979495ab22db34a5dbe (patch) | |
tree | 3fd5349d8a35160af2fed4f39f2322ec300aa976 | |
parent | c409bd015c295ba088af75b117d1dd6ebd8080ba (diff) | |
download | u-boot-c1420f8b2b0f3c833c024979495ab22db34a5dbe.tar.xz |
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.
[ Linux commit : 46fe94ad18aa7ce6b3dad8c035fb538942020f2b ]
Signed-off-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Michal Marek <mmarek@suse.com>
-rw-r--r-- | scripts/basic/fixdep.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/scripts/basic/fixdep.c b/scripts/basic/fixdep.c index e8e8c7756d..9bd0de2490 100644 --- a/scripts/basic/fixdep.c +++ b/scripts/basic/fixdep.c @@ -296,7 +296,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; |