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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 2F2A915808C for ; Sat, 12 Feb 2022 17:13:24 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 676B4E07ED; Sat, 12 Feb 2022 17:13:23 +0000 (UTC) Received: from smtp.gentoo.org (woodpecker.gentoo.org [140.211.166.183]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 4ECFFE07ED for ; Sat, 12 Feb 2022 17:13:23 +0000 (UTC) Received: from oystercatcher.gentoo.org (unknown [IPv6:2a01:4f8:202:4333:225:90ff:fed9:fc84]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id B2CB8342F57 for ; Sat, 12 Feb 2022 17:13:21 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 0BA2D1BD for ; Sat, 12 Feb 2022 17:13:20 +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: <1644682915.6474196695f7092f7725af8565507fad9b7cf961.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: 6474196695f7092f7725af8565507fad9b7cf961 X-VCS-Branch: master Date: Sat, 12 Feb 2022 17:13:20 +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: 72feaaaf-07ba-48b2-a003-745645583912 X-Archives-Hash: ba6623a23f806b9efad993680fa92baf commit: 6474196695f7092f7725af8565507fad9b7cf961 Author: Fabian Groffen gentoo org> AuthorDate: Sat Feb 12 16:21:55 2022 +0000 Commit: Fabian Groffen gentoo org> CommitDate: Sat Feb 12 16:21:55 2022 +0000 URL: https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=64741966 qmerge: fix Coverity NULL_RETURNS (possibly passing NULL) CID 248879 buf (EAPI) and phases can be NULL, substitute EAPI, don't run phase-funcs when no phases are present. Signed-off-by: Fabian Groffen gentoo.org> qmerge.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/qmerge.c b/qmerge.c index 7b738ee..501011a 100644 --- a/qmerge.c +++ b/qmerge.c @@ -1518,6 +1518,8 @@ pkg_unmerge(tree_pkg_ctx *pkg_ctx, depend_atom *rpkg, set *keep, * the replacement package */ if (!pretend && rpkg == NULL) { buf = tree_pkg_meta_get(pkg_ctx, EAPI); + if (buf == NULL) + buf = "0"; /* default */ phases = tree_pkg_meta_get(pkg_ctx, DEFINED_PHASES); if (phases != NULL) { mkdirat(pkg_ctx->fd, "temp", 0755); @@ -1657,9 +1659,13 @@ pkg_unmerge(tree_pkg_ctx *pkg_ctx, depend_atom *rpkg, set *keep, if (!pretend) { buf = tree_pkg_meta_get(pkg_ctx, EAPI); phases = tree_pkg_meta_get(pkg_ctx, DEFINED_PHASES); - /* execute the pkg_postrm step */ - pkg_run_func_at(pkg_ctx->fd, ".", phases, PKG_POSTRM, - T, T, buf, rpkg == NULL ? "" : rpkg->PVR); + if (buf == NULL) + buf = "0"; /* default */ + if (phases != NULL) { + /* execute the pkg_postrm step */ + pkg_run_func_at(pkg_ctx->fd, ".", phases, PKG_POSTRM, + T, T, buf, rpkg == NULL ? "" : rpkg->PVR); + } /* finally delete the vdb entry */ rm_rf_at(pkg_ctx->fd, ".");