From d3bebf2656554d39ab1e8f086244d75b4e2cbccd Mon Sep 17 00:00:00 2001 From: Panu Matilainen Date: Fri, 13 Aug 2010 10:58:51 +0300 Subject: [PATCH] Lose the now unnecessary rpmtsSELinuxEnabled() function - it never was anything more than a cached value of is_selinux_enabled() and caching this fairly expensive result is no longer needed as scriptlet execution wrt selinux contexts is now conditionalized on RPMTRANS_FLAG_NOCONTEXTS instead --- lib/rpmts.c | 8 -------- lib/rpmts.h | 7 ------- lib/rpmts_internal.h | 1 - lib/transaction.c | 2 +- 4 files changed, 1 insertion(+), 17 deletions(-) diff --git a/lib/rpmts.c b/lib/rpmts.c index 20e2588..43966e9 100644 --- a/lib/rpmts.c +++ b/lib/rpmts.c @@ -685,11 +685,6 @@ void rpmtsSetScriptFd(rpmts ts, FD_t scriptFd) } } -int rpmtsSELinuxEnabled(rpmts ts) -{ - return (ts != NULL ? (ts->selinuxEnabled > 0) : 0); -} - rpm_tid_t rpmtsGetTid(rpmts ts) { rpm_tid_t tid = (rpm_tid_t)-1; /* XXX -1 is time(2) error return. */ @@ -901,9 +896,6 @@ rpmts rpmtsCreate(void) ts->members = tsmem; ts->rootDir = NULL; - - ts->selinuxEnabled = is_selinux_enabled(); - ts->keyring = NULL; ts->nrefs = 0; diff --git a/lib/rpmts.h b/lib/rpmts.h index 9b7c306..8ea01f3 100644 --- a/lib/rpmts.h +++ b/lib/rpmts.h @@ -390,13 +390,6 @@ FD_t rpmtsScriptFd(rpmts ts); void rpmtsSetScriptFd(rpmts ts, FD_t scriptFd); /** \ingroup rpmts - * Get selinuxEnabled flag, i.e. is SE linux enabled? - * @param ts transaction set - * @return selinuxEnabled flag - */ -int rpmtsSELinuxEnabled(rpmts ts); - -/** \ingroup rpmts * Get transaction id, i.e. transaction time stamp. * @param ts transaction set * @return transaction id diff --git a/lib/rpmts_internal.h b/lib/rpmts_internal.h index bfa52ca..1a16457 100644 --- a/lib/rpmts_internal.h +++ b/lib/rpmts_internal.h @@ -43,7 +43,6 @@ struct rpmts_s { tsMembers members; /*!< Transaction set member info (order etc) */ - int selinuxEnabled; /*!< Is SE linux enabled? */ char * rootDir; /*!< Path to top of install tree. */ char * lockPath; /*!< Transaction lock path */ FD_t scriptFd; /*!< Scriptlet stdout/stderr. */ diff --git a/lib/transaction.c b/lib/transaction.c index 5202ee2..31abe4f 100644 --- a/lib/transaction.c +++ b/lib/transaction.c @@ -1262,7 +1262,7 @@ static int rpmtsSetup(rpmts ts, rpmprobFilterFlags ignoreSet) (void) rpmtsSetFlags(ts, (rpmtsFlags(ts) | _noTransScripts | _noTransTriggers)); /* if SELinux isn't enabled, init fails or test run, don't bother... */ - if (!rpmtsSELinuxEnabled(ts) || (rpmtsFlags(ts) & RPMTRANS_FLAG_TEST)) { + if (!is_selinux_enabled() || (rpmtsFlags(ts) & RPMTRANS_FLAG_TEST)) { rpmtsSetFlags(ts, (rpmtsFlags(ts) | RPMTRANS_FLAG_NOCONTEXTS)); } -- 2.7.4