Gentoo Archives: gentoo-commits

From: Fabian Groffen <grobian@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/proj/prefix:master commit in: scripts/rsync-generation/
Date: Thu, 01 Mar 2018 10:55:39
Message-Id: 1519901664.c7d6ecd8600f5a69f95427176e2f23a0b84e7e75.grobian@gentoo
1 commit: c7d6ecd8600f5a69f95427176e2f23a0b84e7e75
2 Author: Fabian Groffen <grobian <AT> gentoo <DOT> org>
3 AuthorDate: Thu Mar 1 10:54:24 2018 +0000
4 Commit: Fabian Groffen <grobian <AT> gentoo <DOT> org>
5 CommitDate: Thu Mar 1 10:54:24 2018 +0000
6 URL: https://gitweb.gentoo.org/repo/proj/prefix.git/commit/?id=c7d6ecd8
7
8 scripts/rsync-generation/hashgen: return when write_hashes would produce garbage
9
10 If we can't stat the file we're writing hashes for, we're not going to
11 produce anything useful and something up in the stack went wrong
12 already.
13
14 scripts/rsync-generation/hashgen.c | 17 ++++++++++-------
15 1 file changed, 10 insertions(+), 7 deletions(-)
16
17 diff --git a/scripts/rsync-generation/hashgen.c b/scripts/rsync-generation/hashgen.c
18 index 833c8e7205..534d278d91 100644
19 --- a/scripts/rsync-generation/hashgen.c
20 +++ b/scripts/rsync-generation/hashgen.c
21 @@ -224,8 +224,10 @@ write_hashes(
22
23 snprintf(fname, sizeof(fname), "%s/%s", root, name);
24
25 - if (stat(fname, &s) == 0)
26 - update_times(tv, &s);
27 + if (stat(fname, &s) != 0)
28 + return;
29 +
30 + update_times(tv, &s);
31
32 get_hashes(fname, sha256, sha512, whrlpl, blak2b, &flen);
33
34 @@ -1275,6 +1277,7 @@ process_dir_vrfy(const char *dir)
35 {
36 char buf[8192];
37 int newhashes;
38 + char *ret = NULL;
39
40 fprintf(stdout, "verifying %s...\n", dir);
41 snprintf(buf, sizeof(buf), "%s/metadata/layout.conf", dir);
42 @@ -1290,7 +1293,7 @@ process_dir_vrfy(const char *dir)
43 }
44
45 if (verify_gpg_sig(str_manifest) != 0)
46 - return "gpg signature invalid";
47 + ret = "gpg signature invalid";
48
49 /* verification goes like this:
50 * - verify the signature of the top-level Manifest file (done
51 @@ -1301,9 +1304,9 @@ process_dir_vrfy(const char *dir)
52 * - recurse into directories for which Manifest files are defined
53 */
54 if (verify_manifest(".\0", str_manifest) != 0)
55 - return "manifest verification failed";
56 + ret = "manifest verification failed";
57
58 - return NULL;
59 + return ret;
60 }
61
62 int
63 @@ -1339,14 +1342,14 @@ main(int argc, char *argv[])
64 if (argc > 1) {
65 for (; arg < argc; arg++) {
66 rsn = runfunc(argv[arg]);
67 - if (rsn != NULL) {
68 + if (runfunc == &process_dir_vrfy && rsn != NULL) {
69 printf("%s\n", rsn);
70 ret |= 1;
71 }
72 }
73 } else {
74 rsn = runfunc(".");
75 - if (rsn != NULL) {
76 + if (runfunc == &process_dir_vrfy && rsn != NULL) {
77 printf("%s\n", rsn);
78 ret |= 1;
79 }