summaryrefslogtreecommitdiff
path: root/build/parseBuildInstallClean.c
diff options
context:
space:
mode:
authorPanu Matilainen <pmatilai@redhat.com>2008-05-05 10:34:33 +0300
committerPanu Matilainen <pmatilai@redhat.com>2008-05-05 10:34:33 +0300
commit4e1e3b4aa9e2a3c29d67d889461284994feceffa (patch)
treeca037daaeafdbb92ce642a471de1d06db853ec9d /build/parseBuildInstallClean.c
parent6e1e700a251cd91b1177b56ae74fc52ea18b0432 (diff)
downloadrpm-4e1e3b4aa9e2a3c29d67d889461284994feceffa.tar.gz
rpm-4e1e3b4aa9e2a3c29d67d889461284994feceffa.tar.bz2
rpm-4e1e3b4aa9e2a3c29d67d889461284994feceffa.zip
Make parseBuildInstallClean() return PART_ERROR on errors, streamline exits
Diffstat (limited to 'build/parseBuildInstallClean.c')
-rw-r--r--build/parseBuildInstallClean.c29
1 files changed, 18 insertions, 11 deletions
diff --git a/build/parseBuildInstallClean.c b/build/parseBuildInstallClean.c
index e29b38e3f..6f7421e69 100644
--- a/build/parseBuildInstallClean.c
+++ b/build/parseBuildInstallClean.c
@@ -11,7 +11,7 @@
int parseBuildInstallClean(rpmSpec spec, rpmParseState parsePart)
{
- int nextPart, rc;
+ int nextPart, rc, res = PART_ERROR;
StringBuf *sbp = NULL;
const char *name = NULL;
@@ -32,24 +32,31 @@ int parseBuildInstallClean(rpmSpec spec, rpmParseState parsePart)
if (*sbp != NULL) {
rpmlog(RPMLOG_ERR, _("line %d: second %s\n"),
spec->lineNum, name);
- return RPMRC_FAIL;
+ goto exit;
}
*sbp = newStringBuf();
/* There are no options to %build, %install, %check, or %clean */
- if ((rc = readLine(spec, STRIP_NOTHING)) > 0)
- return PART_NONE;
- if (rc != RPMRC_OK)
- return rc;
+ if ((rc = readLine(spec, STRIP_NOTHING)) > 0) {
+ res = PART_NONE;
+ goto exit;
+ } else if (rc < 0) {
+ goto exit;
+ }
while (! (nextPart = isPart(spec->line))) {
appendStringBuf(*sbp, spec->line);
- if ((rc = readLine(spec, STRIP_NOTHING)) > 0)
- return PART_NONE;
- if (rc)
- return rc;
+ if ((rc = readLine(spec, STRIP_NOTHING)) > 0) {
+ nextPart = PART_NONE;
+ break;
+ } else if (rc < 0) {
+ goto exit;
+ }
}
+ res = nextPart;
+
+exit:
- return nextPart;
+ return res;
}