aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/basic
diff options
context:
space:
mode:
authorBen Gamari <bgamari.foss@gmail.com>2010-12-22 13:30:14 -0500
committerMichal Marek <mmarek@suse.cz>2010-12-22 17:23:28 -0500
commita3ba81131aca243bfecfa78c42edec0cd69f72d6 (patch)
treea0123e86341b51ebef2f4e42046e523330cf7004 /scripts/basic
parent6e5f6856427abe5418f535cb46c454ae8ea7f8e7 (diff)
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/basic')
-rw-r--r--scripts/basic/fixdep.c10
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)
286 286
287 fd = open(filename, O_RDONLY); 287 fd = open(filename, O_RDONLY);
288 if (fd < 0) { 288 if (fd < 0) {
289 fprintf(stderr, "fixdep: "); 289 fprintf(stderr, "fixdep: error opening config file: ");
290 perror(filename); 290 perror(filename);
291 exit(2); 291 exit(2);
292 } 292 }
@@ -357,11 +357,15 @@ static void print_deps(void)
357 357
358 fd = open(depfile, O_RDONLY); 358 fd = open(depfile, O_RDONLY);
359 if (fd < 0) { 359 if (fd < 0) {
360 fprintf(stderr, "fixdep: "); 360 fprintf(stderr, "fixdep: error opening depfile: ");
361 perror(depfile); 361 perror(depfile);
362 exit(2); 362 exit(2);
363 } 363 }
364 fstat(fd, &st); 364 if (fstat(fd, &st) < 0) {
365 fprintf(stderr, "fixdep: error fstat'ing depfile: ");
366 perror(depfile);
367 exit(2);
368 }
365 if (st.st_size == 0) { 369 if (st.st_size == 0) {
366 fprintf(stderr,"fixdep: %s is empty\n",depfile); 370 fprintf(stderr,"fixdep: %s is empty\n",depfile);
367 close(fd); 371 close(fd);