]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
kbuild: fixdep: Check fstat(2) return value
authorTom Rini <trini@konsulko.com>
Mon, 7 Dec 2015 21:26:08 +0000 (16:26 -0500)
committerMichal Marek <mmarek@suse.com>
Wed, 17 Feb 2016 21:52:04 +0000 (22:52 +0100)
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>
scripts/basic/fixdep.c

index 5b327c67a828dd45889f98cfac8f2a8f3e1e4c64..caef815d17431c3616ebefb2ac4eef2bde5f1f52 100644 (file)
@@ -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;