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