Skip to content
Snippets Groups Projects
Commit a3ba8113 authored by Ben Gamari's avatar Ben Gamari Committed by Michal Marek
Browse files

Make fixdep error handling more explicit


Also add missing error handling to fstat call

Signed-off-by: default avatarBen Gamari <bgamari.foss@gmail.com>
Signed-off-by: default avatarMichal Marek <mmarek@suse.cz>
parent 6e5f6856
Branches
Tags
No related merge requests found
...@@ -286,7 +286,7 @@ static void do_config_file(const char *filename) ...@@ -286,7 +286,7 @@ static void do_config_file(const char *filename)
fd = open(filename, O_RDONLY); fd = open(filename, O_RDONLY);
if (fd < 0) { if (fd < 0) {
fprintf(stderr, "fixdep: "); fprintf(stderr, "fixdep: error opening config file: ");
perror(filename); perror(filename);
exit(2); exit(2);
} }
...@@ -357,11 +357,15 @@ static void print_deps(void) ...@@ -357,11 +357,15 @@ static void print_deps(void)
fd = open(depfile, O_RDONLY); fd = open(depfile, O_RDONLY);
if (fd < 0) { if (fd < 0) {
fprintf(stderr, "fixdep: "); fprintf(stderr, "fixdep: error opening depfile: ");
perror(depfile);
exit(2);
}
if (fstat(fd, &st) < 0) {
fprintf(stderr, "fixdep: error fstat'ing depfile: ");
perror(depfile); perror(depfile);
exit(2); exit(2);
} }
fstat(fd, &st);
if (st.st_size == 0) { if (st.st_size == 0) {
fprintf(stderr,"fixdep: %s is empty\n",depfile); fprintf(stderr,"fixdep: %s is empty\n",depfile);
close(fd); close(fd);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment