[Rpm-maint] [PATCH 2/2] remove the 'path' parameter of rpmtsSELabelInit()

Ales Kozumplik akozumpl at redhat.com
Thu Dec 22 14:50:35 UTC 2011


- It is always selinux_file_context_path() anyway.
---
 lib/rpmts.c          |    4 +++-
 lib/rpmts_internal.h |    3 +--
 lib/transaction.c    |    4 ++--
 plugins/sepolicy.c   |    2 +-
 4 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/lib/rpmts.c b/lib/rpmts.c
index 8641149..5619c91 100644
--- a/lib/rpmts.c
+++ b/lib/rpmts.c
@@ -738,9 +738,11 @@ struct selabel_handle * rpmtsSELabelHandle(rpmts ts)
     return NULL;
 }
 
-rpmRC rpmtsSELabelInit(rpmts ts, int open_status, const char *path)
+rpmRC rpmtsSELabelInit(rpmts ts, int open_status)
 {
 #if WITH_SELINUX
+    const char * path = selinux_file_context_path();
+
     if (ts == NULL || path == NULL) {
 	return RPMRC_FAIL;
     }
diff --git a/lib/rpmts_internal.h b/lib/rpmts_internal.h
index b4213fe..e863230 100644
--- a/lib/rpmts_internal.h
+++ b/lib/rpmts_internal.h
@@ -92,10 +92,9 @@ struct selabel_handle * rpmtsSELabelHandle(rpmts ts);
  * Initialize selabel
  * @param ts		transaction set
  * @param open_status   if the func should open selinux status or just check it
- * @param path		path to contexts file
  * @return		RPMRC_OK on success, RPMRC_FAIL otherwise
  */
-rpmRC rpmtsSELabelInit(rpmts ts, int open_status, const char * path);
+rpmRC rpmtsSELabelInit(rpmts ts, int open_status);
 
 /** \ingroup rpmts
  * Clean up selabel
diff --git a/lib/transaction.c b/lib/transaction.c
index b811c90..e117f62 100644
--- a/lib/transaction.c
+++ b/lib/transaction.c
@@ -1256,7 +1256,7 @@ static int rpmtsSetup(rpmts ts, rpmprobFilterFlags ignoreSet)
     /* if SELinux isn't enabled, init fails or test run, don't bother... */
     if (!is_selinux_enabled() || (rpmtsFlags(ts) & RPMTRANS_FLAG_TEST) ||
 	(rpmtsFlags(ts) & RPMTRANS_FLAG_NOCONTEXTS) ||
-	rpmtsSELabelInit(ts, 1, selinux_file_context_path())) {
+	rpmtsSELabelInit(ts, 1)) {
         rpmtsSetFlags(ts, (rpmtsFlags(ts) | RPMTRANS_FLAG_NOCONTEXTS));
 	rpmlog(RPMLOG_DEBUG, "Selinux disabled.\n");
     }
@@ -1384,7 +1384,7 @@ static int rpmtsProcess(rpmts ts)
 		rpmteNEVR(p), rpmteA(p), rpmteO(p), rpmteColor(p));
 
 	if (!(rpmtsFlags(ts) & RPMTRANS_FLAG_NOCONTEXTS)) {
-	    rpmtsSELabelInit(ts, 0, selinux_file_context_path());
+	    rpmtsSELabelInit(ts, 0);
 	}
 
 	failed = rpmteProcess(p, rpmteType(p));
diff --git a/plugins/sepolicy.c b/plugins/sepolicy.c
index adbbd13..52674c1 100644
--- a/plugins/sepolicy.c
+++ b/plugins/sepolicy.c
@@ -556,7 +556,7 @@ static rpmRC sepolGo(void)
     /* re-init selinux and re-read the files contexts, since things may have changed */
     selinux_reset_config();
     if (!(rpmtsFlags(ts) & RPMTRANS_FLAG_NOCONTEXTS)) {
-	if (rpmtsSELabelInit(ts, 0, selinux_file_context_path()) == RPMRC_OK) {
+	if (rpmtsSELabelInit(ts, 0) == RPMRC_OK) {
 	    /* if this was the first time installing policy, every package before
 	     * policy was installed will be mislabeled (e.g. semodule). So, relabel
 	     * the entire filesystem if this is the case */
-- 
1.7.7.3



More information about the Rpm-maint mailing list