summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFabian Groffen <grobian@gentoo.org>2017-11-29 16:35:43 +0100
committerFabian Groffen <grobian@gentoo.org>2017-11-29 16:35:43 +0100
commit8134627701e2eea2a0eb590f6bd80064a2496ecf (patch)
tree111da6511814fe4d52bc4430f77f1043fa5100a0 /scripts
parentsys-devel/binutils-config: fix returned buffer from find_real_ld, bug #639172 (diff)
downloadprefix-8134627701e2eea2a0eb590f6bd80064a2496ecf.tar.gz
prefix-8134627701e2eea2a0eb590f6bd80064a2496ecf.tar.bz2
prefix-8134627701e2eea2a0eb590f6bd80064a2496ecf.zip
hashgen: avoid empty Manifest references
Diffstat (limited to 'scripts')
-rw-r--r--scripts/rsync-generation/hashgen.c35
1 files changed, 19 insertions, 16 deletions
diff --git a/scripts/rsync-generation/hashgen.c b/scripts/rsync-generation/hashgen.c
index 68d5575ad2..034ea7f170 100644
--- a/scripts/rsync-generation/hashgen.c
+++ b/scripts/rsync-generation/hashgen.c
@@ -289,25 +289,28 @@ process_dir(const char *dir)
hashes = newhashes;
}
- snprintf(manifest, sizeof(manifest), "%s/Manifest", dir);
+ snprintf(manifest, sizeof(manifest), "%s/%s", dir, str_manifest);
if ((f = fopen(manifest, "r")) == NULL) {
gzFile mf;
- /* open up a gzipped Manifest to keep the hashes of the
- * Manifests in the subdirs */
- snprintf(manifest, sizeof(manifest), "%s/Manifest.gz", dir);
- if ((mf = gzopen(manifest, "wb9")) == NULL) {
- fprintf(stderr, "failed to open file '%s' for writing: %s\n",
- manifest, strerror(errno));
- return NULL;
- }
-
/* recurse into subdirs */
if ((d = opendir(dir)) != NULL) {
struct stat s;
+
+ /* open up a gzipped Manifest to keep the hashes of the
+ * Manifests in the subdirs */
+ snprintf(manifest, sizeof(manifest), "%s/%s", dir, str_manifest_gz);
+ if ((mf = gzopen(manifest, "wb9")) == NULL) {
+ fprintf(stderr, "failed to open file '%s' for writing: %s\n",
+ manifest, strerror(errno));
+ return NULL;
+ }
+
while ((e = readdir(d)) != NULL) {
if (e->d_name[0] == '.')
continue;
+ if (strcmp(e->d_name, str_manifest_gz) == 0)
+ continue;
snprintf(path, sizeof(path), "%s/%s", dir, e->d_name);
if (!stat(path, &s)) {
if (s.st_mode & S_IFDIR) {
@@ -324,13 +327,13 @@ process_dir(const char *dir)
}
}
closedir(d);
- }
- gzclose(mf);
- if (tv[0].tv_sec != 0) {
- /* restore dir mtime, and set Manifest mtime to match it */
- utimes(manifest, tv);
- utimes(dir, tv);
+ gzclose(mf);
+ if (tv[0].tv_sec != 0) {
+ /* restore dir mtime, and set Manifest mtime to match it */
+ utimes(manifest, tv);
+ utimes(dir, tv);
+ }
}
return str_manifest_gz;