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 7443B139085 for ; Tue, 7 Feb 2017 03:04:25 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id BBBE921C1FA; Tue, 7 Feb 2017 03:03:36 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 993E721C1FA for ; Tue, 7 Feb 2017 03:03:36 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 6CA733416A1 for ; Tue, 7 Feb 2017 03:03:35 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 897353A86 for ; Tue, 7 Feb 2017 03:03:33 +0000 (UTC) From: "Mike Frysinger" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Mike Frysinger" Message-ID: <1486436330.b7edba4e6c51901f40aefca78be5095e9dd434a4.vapier@gentoo> Subject: [gentoo-commits] proj/portage-utils:master commit in: / X-VCS-Repository: proj/portage-utils X-VCS-Files: qmerge.c qxpak.c X-VCS-Directories: / X-VCS-Committer: vapier X-VCS-Committer-Name: Mike Frysinger X-VCS-Revision: b7edba4e6c51901f40aefca78be5095e9dd434a4 X-VCS-Branch: master Date: Tue, 7 Feb 2017 03:03:33 +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: 63ec1bcb-c1cb-403b-b019-cf8015ad7c32 X-Archives-Hash: bae57e3fe01f56a809659f88ac5e96f1 commit: b7edba4e6c51901f40aefca78be5095e9dd434a4 Author: Mike Frysinger gentoo org> AuthorDate: Tue Feb 7 02:58:50 2017 +0000 Commit: Mike Frysinger gentoo org> CommitDate: Tue Feb 7 02:58:50 2017 +0000 URL: https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=b7edba4e avoid assert() with active code Since assert can be compiled out via -DNDEBUG, make sure we don't put function calls in there we need to work. Reported-by: Ian Coolidge google.com> qmerge.c | 6 ++++-- qxpak.c | 4 +++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/qmerge.c b/qmerge.c index e84fcbb..07da4cc 100644 --- a/qmerge.c +++ b/qmerge.c @@ -902,11 +902,13 @@ pkg_merge(int level, const depend_atom *atom, const struct pkg_t *pkg) /* split the tbz and xpak data */ xasprintf(&tbz2, "%s/%s/%s.tbz2", pkgdir, pkg->CATEGORY, pkg->PF); - assert(run_applet_l("qtbz2", "-s", tbz2, NULL) == 0); + if (run_applet_l("qtbz2", "-s", tbz2, NULL) != 0) + err("`qtbz2 -s %s` failed", tbz2); mkdir("vdb", 0755); sprintf(tbz2, "%s.xpak", pkg->PF); - assert(run_applet_l("qxpak", "-d", "vdb", "-x", tbz2, NULL) == 0); + if (run_applet_l("qxpak", "-d", "vdb", "-x", tbz2, NULL) != 0) + err("`qxpak -d vdb -x %s` failed", tbz2); free(tbz2); diff --git a/qxpak.c b/qxpak.c index 58b29ef..95fb779 100644 --- a/qxpak.c +++ b/qxpak.c @@ -154,6 +154,7 @@ xpak_list(int dir_fd, const char *file, int argc, char **argv) { _xpak_archive *x; char buf[BUFSIZE]; + size_t ret; x = _xpak_open(file); if (!x) @@ -162,7 +163,8 @@ xpak_list(int dir_fd, const char *file, int argc, char **argv) x->dir_fd = dir_fd; x->index = buf; assert((size_t)x->index_len < sizeof(buf)); - assert(fread(x->index, 1, x->index_len, x->fp) == (size_t)x->index_len); + ret = fread(x->index, 1, x->index_len, x->fp); + assert(ret == (size_t)x->index_len); _xpak_walk_index(x, argc, argv, &_xpak_list_callback); _xpak_close(x);