1 |
commit: da46fc465724f0a4e519ed82c8d282b31e3e900f |
2 |
Author: Fabian Groffen <grobian <AT> gentoo <DOT> org> |
3 |
AuthorDate: Mon Mar 11 07:15:53 2019 +0000 |
4 |
Commit: Fabian Groffen <grobian <AT> gentoo <DOT> org> |
5 |
CommitDate: Mon Mar 11 07:15:53 2019 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=da46fc46 |
7 |
|
8 |
tests: fix compilation |
9 |
|
10 |
Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org> |
11 |
|
12 |
qcheck.c | 47 +++++++++++++++++++++++++++++++++-------------- |
13 |
tests/mkdir/test.c | 1 - |
14 |
2 files changed, 33 insertions(+), 15 deletions(-) |
15 |
|
16 |
diff --git a/qcheck.c b/qcheck.c |
17 |
index 7b6e58c..b618d50 100644 |
18 |
--- a/qcheck.c |
19 |
+++ b/qcheck.c |
20 |
@@ -1,9 +1,10 @@ |
21 |
/* |
22 |
- * Copyright 2005-2018 Gentoo Foundation |
23 |
+ * Copyright 2005-2019 Gentoo Foundation |
24 |
* Distributed under the terms of the GNU General Public License v2 |
25 |
* |
26 |
* Copyright 2005-2010 Ned Ludd - <solar@g.o> |
27 |
* Copyright 2005-2014 Mike Frysinger - <vapier@g.o> |
28 |
+ * Copyright 2018- Fabian Groffen - <grobian@g.o> |
29 |
*/ |
30 |
|
31 |
#ifdef APPLET_qcheck |
32 |
@@ -120,13 +121,16 @@ qcheck_process_contents(q_vdb_pkg_ctx *pkg_ctx, struct qcheck_opt_state *state) |
33 |
continue; |
34 |
} |
35 |
} |
36 |
- if (fstatat(pkg_ctx->cat_ctx->ctx->portroot_fd, entry->name + 1, &st, AT_SYMLINK_NOFOLLOW)) { |
37 |
+ if (fstatat(pkg_ctx->cat_ctx->ctx->portroot_fd, entry->name + 1, |
38 |
+ &st, AT_SYMLINK_NOFOLLOW)) |
39 |
+ { |
40 |
/* make sure file exists */ |
41 |
if (state->chk_afk) { |
42 |
if (errno == ENOENT) |
43 |
qcprintf(" %sAFK%s: %s\n", RED, NORM, entry->name); |
44 |
else |
45 |
- qcprintf(" %sERROR (%s)%s: %s\n", RED, strerror(errno), NORM, entry->name); |
46 |
+ qcprintf(" %sERROR (%s)%s: %s\n", RED, |
47 |
+ strerror(errno), NORM, entry->name); |
48 |
} else { |
49 |
--num_files; |
50 |
++num_files_ignored; |
51 |
@@ -146,7 +150,9 @@ qcheck_process_contents(q_vdb_pkg_ctx *pkg_ctx, struct qcheck_opt_state *state) |
52 |
if (i == cpm_argc) { |
53 |
/* Not explicitly masked, so it's protected */ |
54 |
for (i = 1; i < cp_argc; ++i) |
55 |
- if (strncmp(cp_argv[i], entry->name, strlen(cp_argv[i])) == 0) { |
56 |
+ if (strncmp(cp_argv[i], entry->name, |
57 |
+ strlen(cp_argv[i])) == 0) |
58 |
+ { |
59 |
num_files_ok++; |
60 |
continue; |
61 |
} |
62 |
@@ -184,7 +190,8 @@ qcheck_process_contents(q_vdb_pkg_ctx *pkg_ctx, struct qcheck_opt_state *state) |
63 |
|
64 |
if (!hash_algo) { |
65 |
if (state->chk_hash) { |
66 |
- qcprintf(" %sUNKNOWN DIGEST%s: '%s' for '%s'\n", RED, NORM, entry->digest, entry->name); |
67 |
+ qcprintf(" %sUNKNOWN DIGEST%s: '%s' for '%s'\n", |
68 |
+ RED, NORM, entry->digest, entry->name); |
69 |
++num_files_unknown; |
70 |
} else { |
71 |
--num_files; |
72 |
@@ -195,8 +202,11 @@ qcheck_process_contents(q_vdb_pkg_ctx *pkg_ctx, struct qcheck_opt_state *state) |
73 |
continue; |
74 |
} |
75 |
|
76 |
- hash_cb_t hash_cb = state->undo_prelink ? hash_cb_prelink_undo : hash_cb_default; |
77 |
- f_digest = (char *)hash_file_at_cb(pkg_ctx->cat_ctx->ctx->portroot_fd, entry->name + 1, hash_algo, hash_cb); |
78 |
+ hash_cb_t hash_cb = |
79 |
+ state->undo_prelink ? hash_cb_prelink_undo : hash_cb_default; |
80 |
+ f_digest = (char *)hash_file_at_cb( |
81 |
+ pkg_ctx->cat_ctx->ctx->portroot_fd, |
82 |
+ entry->name + 1, hash_algo, hash_cb); |
83 |
|
84 |
/* Digest-check 2/3: |
85 |
* Can we get a digest of the file? */ |
86 |
@@ -208,7 +218,9 @@ qcheck_process_contents(q_vdb_pkg_ctx *pkg_ctx, struct qcheck_opt_state *state) |
87 |
fputs(buffer, fp_contents_update); |
88 |
|
89 |
if (verbose) |
90 |
- qcprintf(" %sPERM %4o%s: %s\n", RED, (unsigned int)(st.st_mode & 07777), NORM, entry->name); |
91 |
+ qcprintf(" %sPERM %4o%s: %s\n", |
92 |
+ RED, (unsigned int)(st.st_mode & 07777), |
93 |
+ NORM, entry->name); |
94 |
|
95 |
continue; |
96 |
} |
97 |
@@ -218,7 +230,8 @@ qcheck_process_contents(q_vdb_pkg_ctx *pkg_ctx, struct qcheck_opt_state *state) |
98 |
if (strcmp(entry->digest, f_digest) != 0) { |
99 |
if (state->chk_hash) { |
100 |
if (state->qc_update) |
101 |
- fprintf(fp_contents_update, "obj %s %s %"PRIu64"\n", entry->name, f_digest, (uint64_t)st.st_mtime); |
102 |
+ fprintf(fp_contents_update, "obj %s %s %"PRIu64"\n", |
103 |
+ entry->name, f_digest, (uint64_t)st.st_mtime); |
104 |
|
105 |
const char *digest_disp; |
106 |
switch (hash_algo) { |
107 |
@@ -227,9 +240,11 @@ qcheck_process_contents(q_vdb_pkg_ctx *pkg_ctx, struct qcheck_opt_state *state) |
108 |
default: digest_disp = "UNK"; break; |
109 |
} |
110 |
|
111 |
- qcprintf(" %s%s-DIGEST%s: %s", RED, digest_disp, NORM, entry->name); |
112 |
+ qcprintf(" %s%s-DIGEST%s: %s", |
113 |
+ RED, digest_disp, NORM, entry->name); |
114 |
if (verbose) |
115 |
- qcprintf(" (recorded '%s' != actual '%s')", entry->digest, f_digest); |
116 |
+ qcprintf(" (recorded '%s' != actual '%s')", |
117 |
+ entry->digest, f_digest); |
118 |
qcprintf("\n"); |
119 |
} else { |
120 |
--num_files; |
121 |
@@ -249,15 +264,19 @@ qcheck_process_contents(q_vdb_pkg_ctx *pkg_ctx, struct qcheck_opt_state *state) |
122 |
if (state->chk_mtime && entry->mtime && entry->mtime != st.st_mtime) { |
123 |
qcprintf(" %sMTIME%s: %s", RED, NORM, entry->name); |
124 |
if (verbose) |
125 |
- qcprintf(" (recorded '%"PRIu64"' != actual '%"PRIu64"')", (uint64_t)entry->mtime, (uint64_t)st.st_mtime); |
126 |
+ qcprintf(" (recorded '%"PRIu64"' != actual '%"PRIu64"')", |
127 |
+ (uint64_t)entry->mtime, (uint64_t)st.st_mtime); |
128 |
qcprintf("\n"); |
129 |
|
130 |
/* Update mtime */ |
131 |
if (state->qc_update) { |
132 |
if (entry->type == CONTENTS_SYM) { |
133 |
- fprintf(fp_contents_update, "sym %s -> %s %"PRIu64"\n", entry->name, entry->sym_target, (uint64_t)st.st_mtime); |
134 |
+ fprintf(fp_contents_update, "sym %s -> %s %"PRIu64"\n", |
135 |
+ entry->name, entry->sym_target, |
136 |
+ (uint64_t)st.st_mtime); |
137 |
} else { |
138 |
- fprintf(fp_contents_update, "obj %s %s %"PRIu64"\n", entry->name, entry->digest, (uint64_t)st.st_mtime); |
139 |
+ fprintf(fp_contents_update, "obj %s %s %"PRIu64"\n", |
140 |
+ entry->name, entry->digest, (uint64_t)st.st_mtime); |
141 |
} |
142 |
} |
143 |
|
144 |
|
145 |
diff --git a/tests/mkdir/test.c b/tests/mkdir/test.c |
146 |
index 143bb67..88a4337 100644 |
147 |
--- a/tests/mkdir/test.c |
148 |
+++ b/tests/mkdir/test.c |
149 |
@@ -9,7 +9,6 @@ |
150 |
#include "tests/tests.h" |
151 |
|
152 |
#include "libq/xmalloc.c" |
153 |
-#include "libq/xstrdup.c" |
154 |
#include "libq/xmkdir.c" |
155 |
|
156 |
int main(int argc, char *argv[]) |