From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 6273F139082 for ; Wed, 29 Nov 2017 16:46:14 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 9FDA8E0BE7; Wed, 29 Nov 2017 16:46:13 +0000 (UTC) Received: from smtp.gentoo.org (woodpecker.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 7C267E0BE7 for ; Wed, 29 Nov 2017 16:46:13 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 8817B33C770 for ; Wed, 29 Nov 2017 16:46:12 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 11282ABC7 for ; Wed, 29 Nov 2017 16:46:11 +0000 (UTC) From: "Fabian Groffen" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Fabian Groffen" Message-ID: <1511969743.8134627701e2eea2a0eb590f6bd80064a2496ecf.grobian@gentoo> Subject: [gentoo-commits] repo/proj/prefix:master commit in: scripts/rsync-generation/ X-VCS-Repository: repo/proj/prefix X-VCS-Files: scripts/rsync-generation/hashgen.c X-VCS-Directories: scripts/rsync-generation/ X-VCS-Committer: grobian X-VCS-Committer-Name: Fabian Groffen X-VCS-Revision: 8134627701e2eea2a0eb590f6bd80064a2496ecf X-VCS-Branch: master Date: Wed, 29 Nov 2017 16:46:11 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: 01370aed-051e-4d22-a6f5-fce4a583359f X-Archives-Hash: 4ab7388e17e2c076804638530e983a78 commit: 8134627701e2eea2a0eb590f6bd80064a2496ecf Author: Fabian Groffen gentoo org> AuthorDate: Wed Nov 29 15:35:43 2017 +0000 Commit: Fabian Groffen gentoo org> CommitDate: Wed Nov 29 15:35:43 2017 +0000 URL: https://gitweb.gentoo.org/repo/proj/prefix.git/commit/?id=81346277 hashgen: avoid empty Manifest references scripts/rsync-generation/hashgen.c | 35 +++++++++++++++++++---------------- 1 file 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;