提交 a3ba8113 编写于 作者: B Ben Gamari 提交者: Michal Marek

Make fixdep error handling more explicit

Also add missing error handling to fstat call
Signed-off-by: NBen Gamari <bgamari.foss@gmail.com>
Signed-off-by: NMichal Marek <mmarek@suse.cz>
上级 6e5f6856
......@@ -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);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册