aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFabian Groffen <grobian@gentoo.org>2022-02-12 17:21:55 +0100
committerFabian Groffen <grobian@gentoo.org>2022-02-12 17:21:55 +0100
commit6474196695f7092f7725af8565507fad9b7cf961 (patch)
tree87955bf353545837b76642bb944b28177d441875
parentqlop: Fixed --running --verbose returning unknown ETA (diff)
downloadportage-utils-6474196695f7092f7725af8565507fad9b7cf961.tar.gz
portage-utils-6474196695f7092f7725af8565507fad9b7cf961.tar.bz2
portage-utils-6474196695f7092f7725af8565507fad9b7cf961.zip
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 <grobian@gentoo.org>
-rw-r--r--qmerge.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/qmerge.c b/qmerge.c
index 7b738ee0..501011a6 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, ".");