1 |
commit: 391b8cf8bb3f06b40d108c157630657132a96131 |
2 |
Author: Mike Frysinger <vapier <AT> gentoo <DOT> org> |
3 |
AuthorDate: Tue Jan 5 00:24:50 2016 +0000 |
4 |
Commit: Mike Frysinger <vapier <AT> gentoo <DOT> org> |
5 |
CommitDate: Tue Jan 5 00:24:50 2016 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=391b8cf8 |
7 |
|
8 |
qcheck: improve error reporting for unreadable files |
9 |
|
10 |
We shouldn't flag files that are unreadable as AFK as that implies the |
11 |
files are missing. |
12 |
|
13 |
qcheck.c | 7 +++++-- |
14 |
1 file changed, 5 insertions(+), 2 deletions(-) |
15 |
|
16 |
diff --git a/qcheck.c b/qcheck.c |
17 |
index cdbc507..3718f94 100644 |
18 |
--- a/qcheck.c |
19 |
+++ b/qcheck.c |
20 |
@@ -37,7 +37,7 @@ static const char * const qcheck_opts_help[] = { |
21 |
}; |
22 |
#define qcheck_usage(ret) usage(ret, QCHECK_FLAGS, qcheck_long_opts, qcheck_opts_help, lookup_applet_idx("qcheck")) |
23 |
|
24 |
-#define qcprintf(fmt, args...) if (!state->bad_only) printf(_(fmt), ## args) |
25 |
+#define qcprintf(fmt, args...) do { if (!state->bad_only) printf(_(fmt), ## args); } while (0) |
26 |
|
27 |
struct qcheck_opt_state { |
28 |
int argc; |
29 |
@@ -125,7 +125,10 @@ static int qcheck_process_contents(q_vdb_pkg_ctx *pkg_ctx, struct qcheck_opt_sta |
30 |
if (fstatat(pkg_ctx->cat_ctx->ctx->portroot_fd, e->name + 1, &st, AT_SYMLINK_NOFOLLOW)) { |
31 |
/* make sure file exists */ |
32 |
if (state->chk_afk) { |
33 |
- qcprintf(" %sAFK%s: %s\n", RED, NORM, e->name); |
34 |
+ if (errno == ENOENT) |
35 |
+ qcprintf(" %sAFK%s: %s\n", RED, NORM, e->name); |
36 |
+ else |
37 |
+ qcprintf(" %sERROR (%s)%s: %s\n", RED, strerror(errno), NORM, e->name); |
38 |
} else { |
39 |
--num_files; |
40 |
++num_files_ignored; |