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 B4EA7138359 for ; Sat, 14 Nov 2020 17:06:52 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id EFDFAE041F; Sat, 14 Nov 2020 17:06:51 +0000 (UTC) Received: from smtp.gentoo.org (smtp.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 CE0AFE03EC for ; Sat, 14 Nov 2020 17:06:51 +0000 (UTC) Received: from oystercatcher.gentoo.org (unknown [IPv6:2a01:4f8:202:4333:225:90ff:fed9:fc84]) (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 2BB0D340B81 for ; Sat, 14 Nov 2020 17:06:50 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id A38B444C for ; Sat, 14 Nov 2020 17:06:48 +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: <1605373584.0b59c2de6f0390260c1313823c0c044bfffb48b0.grobian@gentoo> Subject: [gentoo-commits] proj/portage-utils:master commit in: / X-VCS-Repository: proj/portage-utils X-VCS-Files: qmerge.c X-VCS-Directories: / X-VCS-Committer: grobian X-VCS-Committer-Name: Fabian Groffen X-VCS-Revision: 0b59c2de6f0390260c1313823c0c044bfffb48b0 X-VCS-Branch: master Date: Sat, 14 Nov 2020 17:06:48 +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-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: 69c9e9e7-0b38-4551-8c6e-6d7698e1e48f X-Archives-Hash: 4e38fe82f8c540d270c7d6d95992d854 commit: 0b59c2de6f0390260c1313823c0c044bfffb48b0 Author: Fabian Groffen gentoo org> AuthorDate: Sat Nov 14 17:06:24 2020 +0000 Commit: Fabian Groffen gentoo org> CommitDate: Sat Nov 14 17:06:24 2020 +0000 URL: https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=0b59c2de qmerge: adapt style after previous commit Signed-off-by: Fabian Groffen gentoo.org> qmerge.c | 42 ++++++++++++++++++++++-------------------- 1 file changed, 22 insertions(+), 20 deletions(-) diff --git a/qmerge.c b/qmerge.c index 6d98329..73efcb6 100644 --- a/qmerge.c +++ b/qmerge.c @@ -1231,56 +1231,58 @@ pkg_merge(int level, const depend_atom *atom, const struct pkg_t *pkg) * Since some tools (e.g. zstd) complain about the .bz2 * extension, we feed the tool by input redirection. */ snprintf(buf, sizeof(buf), - BUSYBOX " sh -c '%s%s" - "tar -x%sf - -C image/'", + BUSYBOX " sh -c '%s%star -x%sf - -C image/'", compr, compr[0] == '\0' ? "" : " | ", ((verbose > 1) ? "v" : "")); /* start the tar pipe and copy tbz2size binpkg bytes into it * "manually" rather than depending on dd or head */ { - FILE *tarpipe, *tbz2f; + FILE *tarpipe; + FILE *tbz2f; unsigned char iobuf[8192]; int piped = 0; - size_t n, rd, wr; + int err; + size_t n; + size_t rd; + size_t wr; - tarpipe = popen(buf, "w"); - if (NULL == tarpipe) - errp("popen(%s)", buf); + if ((tarpipe = popen(buf, "w")) == NULL) + errp("failed to start %s", buf); - tbz2f = fopen(tbz2, "r"); - if (NULL == tbz2f) - errp("fopen(%s)", tbz2); + if ((tbz2f = fopen(tbz2, "r")) == NULL) + errp("failed to open %s for reading", tbz2); for (piped = wr = 0; piped < tbz2size; piped += wr) { n = MIN(tbz2size - piped, (ssize_t)sizeof iobuf); rd = fread(iobuf, 1, n, tbz2f); if (0 == rd) { - errno = ferror(tbz2f); - if (errno) - errp("fread(%s)", tbz2); + if ((err = ferror(tbz2f)) != 0) + err("reading %s failed: %s", tbz2, strerror(errno)); if (feof(tbz2f)) - err("%s: unexpected EOF; corrupted binpkg", tbz2); + err("unexpected EOF in %s: corrupted binpkg", tbz2); } for (wr = n = 0; wr < rd; wr += n) { n = fwrite(iobuf + wr, 1, rd - wr, tarpipe); if (n != rd - wr) { - errno = ferror(tarpipe); - if (errno) - errp("fwrite(%s)", buf); + if ((err = ferror(tarpipe)) != 0) + err("failed to unpack binpkg: %s", strerror(errno)); if (feof(tarpipe)) - err("%s pipe: unexpected EOF", buf); + err("unexpected EOF trying to unpack binpkg"); } } } fclose(tbz2f); - if (-1 == pclose(tarpipe)) - errp("pclose(%s)", buf); + err = pclose(tarpipe); + if (err > 0) + err("finishing unpack binpkg exited with status %d", err); + else if (err < 0) + errp("finishing unpack binpkg unsuccessful"); } free(tbz2);