From a3ba81131aca243bfecfa78c42edec0cd69f72d6 Mon Sep 17 00:00:00 2001 From: Ben Gamari Date: Wed, 22 Dec 2010 13:30:14 -0500 Subject: Make fixdep error handling more explicit Also add missing error handling to fstat call Signed-off-by: Ben Gamari Signed-off-by: Michal Marek --- scripts/basic/fixdep.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'scripts/basic') diff --git a/scripts/basic/fixdep.c b/scripts/basic/fixdep.c index ed05846..c9a16ab 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); -- cgit v1.1