summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPanu Matilainen <pmatilai@redhat.com>2011-05-30 12:12:24 +0300
committerPanu Matilainen <pmatilai@redhat.com>2011-05-30 12:12:24 +0300
commit7c75179e46a77a3d5c662ea6a19644cc8d220588 (patch)
treefafcb6b85e96de79884daf6d8aea99dc8e64daef
parent2d46bfbfd98a73073708db6068c77f31312e96d5 (diff)
downloadrpm-7c75179e46a77a3d5c662ea6a19644cc8d220588.tar.gz
rpm-7c75179e46a77a3d5c662ea6a19644cc8d220588.tar.bz2
rpm-7c75179e46a77a3d5c662ea6a19644cc8d220588.zip
Minor cleanups to sepolLoadPolicies() in sepolicy plugin
- Having an err label which we fall through on success too seems a bit funny, rename the label to exit - Initialize the sepoltrans at declaration already - Remove redundant RPMRC_FAIL assignment on sepoltransNew() fail case, this already assumes failure - Remove redundant jump to exit from sepoltransCommit() error - Eliminate trailing dead NULL assignment of the local pt variable
-rw-r--r--plugins/sepolicy.c21
1 files changed, 7 insertions, 14 deletions
diff --git a/plugins/sepolicy.c b/plugins/sepolicy.c
index b4fa910ee..a0a9ccc62 100644
--- a/plugins/sepolicy.c
+++ b/plugins/sepolicy.c
@@ -251,14 +251,11 @@ static rpmRC sepolWritePolicy(const sepol * pol, char **path)
static rpmRC sepolLoadPolicies(const sepol * pols)
{
const sepol *pol;
- sepoltrans *pt;
rpmRC rc = RPMRC_FAIL;
+ sepoltrans *pt = sepoltransNew();
- pt = sepoltransNew();
- if (!pt) {
- rc = RPMRC_FAIL;
- goto err;
- }
+ if (pt == NULL)
+ goto exit;
for (pol = pols; pol; pol = pol->next) {
switch (pol->action) {
@@ -274,18 +271,14 @@ static rpmRC sepolLoadPolicies(const sepol * pols)
break;
}
- if (rc != RPMRC_OK) {
- goto err;
- }
+ if (rc != RPMRC_OK)
+ goto exit;
}
rc = sepoltransCommit(pt);
- if (rc != RPMRC_OK) {
- goto err;
- }
- err:
- pt = sepoltransFree(pt);
+exit:
+ sepoltransFree(pt);
return rc;
}