diff options
author | Ben Gamari <bgamari.foss@gmail.com> | 2010-12-22 13:30:14 -0500 |
---|---|---|
committer | Michal Marek <mmarek@suse.cz> | 2010-12-22 23:23:28 +0100 |
commit | a3ba81131aca243bfecfa78c42edec0cd69f72d6 (patch) | |
tree | a0123e86341b51ebef2f4e42046e523330cf7004 /scripts | |
parent | 6e5f6856427abe5418f535cb46c454ae8ea7f8e7 (diff) | |
download | lwn-a3ba81131aca243bfecfa78c42edec0cd69f72d6.tar.gz lwn-a3ba81131aca243bfecfa78c42edec0cd69f72d6.zip |
Make fixdep error handling more explicit
Also add missing error handling to fstat call
Signed-off-by: Ben Gamari <bgamari.foss@gmail.com>
Signed-off-by: Michal Marek <mmarek@suse.cz>
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/basic/fixdep.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/scripts/basic/fixdep.c b/scripts/basic/fixdep.c index ed0584623690..c9a16abacab4 100644 --- a/scripts/basic/fixdep.c +++ b/scripts/basic/fixdep.c @@ -286,7 +286,7 @@ static void do_config_file(const char *filename) fd = open(filename, O_RDONLY); if (fd < 0) { - fprintf(stderr, "fixdep: "); + fprintf(stderr, "fixdep: error opening config file: "); perror(filename); exit(2); } @@ -357,11 +357,15 @@ static void print_deps(void) fd = open(depfile, O_RDONLY); if (fd < 0) { - fprintf(stderr, "fixdep: "); + fprintf(stderr, "fixdep: error opening depfile: "); perror(depfile); exit(2); } - fstat(fd, &st); + if (fstat(fd, &st) < 0) { + fprintf(stderr, "fixdep: error fstat'ing depfile: "); + perror(depfile); + exit(2); + } if (st.st_size == 0) { fprintf(stderr,"fixdep: %s is empty\n",depfile); close(fd); |