From 4181d7adadecf64102e620a23a697c756e3602c9 Mon Sep 17 00:00:00 2001 From: Panu Matilainen Date: Sat, 15 Nov 2008 18:44:00 +0200 Subject: [PATCH] Assume failure in rpmInstallSourcePackage() - avoids bunch of redundant assignments --- lib/psm.c | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/lib/psm.c b/lib/psm.c index 26cf0a1..7838278 100644 --- a/lib/psm.c +++ b/lib/psm.c @@ -249,18 +249,16 @@ rpmRC rpmInstallSourcePackage(rpmts ts, FD_t fd, if (h == NULL) goto exit; - rpmrc = RPMRC_OK; + rpmrc = RPMRC_FAIL; /* assume failure */ isSource = headerIsSource(h); if (!isSource) { rpmlog(RPMLOG_ERR, _("source package expected, binary found\n")); - rpmrc = RPMRC_FAIL; goto exit; } if (rpmtsAddInstallElement(ts, h, NULL, 0, NULL)) { - rpmrc = RPMRC_FAIL; goto exit; } @@ -268,13 +266,11 @@ rpmRC rpmInstallSourcePackage(rpmts ts, FD_t fd, h = headerFree(h); if (fi == NULL) { /* XXX can't happen */ - rpmrc = RPMRC_FAIL; goto exit; } fi->te = rpmtsElement(ts, 0); if (fi->te == NULL) { /* XXX can't happen */ - rpmrc = RPMRC_FAIL; goto exit; } @@ -312,7 +308,6 @@ rpmRC rpmInstallSourcePackage(rpmts ts, FD_t fd, } if (rpmMkdirs(rpmtsRootDir(ts), "%{_topdir}:%{_sourcedir}:%{_specdir}")) { - rpmrc = RPMRC_FAIL; goto exit; } /* Build dnl/dil with {_sourcedir, _specdir} as values. */ @@ -344,7 +339,6 @@ rpmRC rpmInstallSourcePackage(rpmts ts, FD_t fd, free(_sourcedir); } else { rpmlog(RPMLOG_ERR, _("source package contains no .spec file\n")); - rpmrc = RPMRC_FAIL; goto exit; } @@ -352,12 +346,11 @@ rpmRC rpmInstallSourcePackage(rpmts ts, FD_t fd, psm->goal = PSM_PKGINSTALL; /* FIX: psm->fi->dnl should be owned. */ - rpmrc = rpmpsmStage(psm, PSM_PROCESS); + if (rpmpsmStage(psm, PSM_PROCESS) == RPMRC_OK) + rpmrc = RPMRC_OK; (void) rpmpsmStage(psm, PSM_FINI); - if (rpmrc) rpmrc = RPMRC_FAIL; - exit: if (specFilePtr && specFile && rpmrc == RPMRC_OK) *specFilePtr = specFile; -- 2.7.4