[pacman-dev] [PATCH] Fix FS#8905 (-Sp as non-root) RESUBMIT
Nagy Gabor
ngaba at bibl.u-szeged.hu
Sat Mar 8 12:58:07 EST 2008
From c268ac9ee0afa9413ce4c91d4fcc8cb3c91ee0b1 Mon Sep 17 00:00:00 2001
From: Nagy Gabor <ngaba at bibl.u-szeged.hu>
Date: Sat, 8 Mar 2008 18:57:26 +0100
Subject: [PATCH] Fix FS#8905 (-Sp as non-root)
This patch is quite ugly, but solves the issue without API change.
Signed-off-by: Nagy Gabor <ngaba at bibl.u-szeged.hu>
---
lib/libalpm/trans.c | 14 +++++++++++---
1 files changed, 11 insertions(+), 3 deletions(-)
diff --git a/lib/libalpm/trans.c b/lib/libalpm/trans.c
index 52dbe7a..a19fb28 100644
--- a/lib/libalpm/trans.c
+++ b/lib/libalpm/trans.c
@@ -72,9 +72,11 @@ int SYMEXPORT alpm_trans_init(pmtranstype_t type, pmtransflag_t flags,
ASSERT(handle->trans == NULL, RET_ERR(PM_ERR_TRANS_NOT_NULL, -1));
/* lock db */
- handle->lckfd = _alpm_lckmk();
- if(handle->lckfd == -1) {
- RET_ERR(PM_ERR_HANDLE_LOCK, -1);
+ if(!(type == PM_TRANS_TYPE_SYNC && flags & PM_TRANS_FLAG_PRINTURIS)) {
+ handle->lckfd = _alpm_lckmk();
+ if(handle->lckfd == -1) {
+ RET_ERR(PM_ERR_HANDLE_LOCK, -1);
+ }
}
handle->trans = _alpm_trans_new();
@@ -190,6 +192,7 @@ int SYMEXPORT alpm_trans_interrupt()
int SYMEXPORT alpm_trans_release()
{
pmtrans_t *trans;
+ int nolock;
ALPM_LOG_FUNC;
@@ -200,10 +203,15 @@ int SYMEXPORT alpm_trans_release()
ASSERT(trans != NULL, RET_ERR(PM_ERR_TRANS_NULL, -1));
ASSERT(trans->state != STATE_IDLE, RET_ERR(PM_ERR_TRANS_NULL, -1));
+ nolock = (trans->type == PM_TRANS_TYPE_SYNC) && (trans->flags & PM_TRANS_FLAG_PRINTURIS);
+
_alpm_trans_free(trans);
handle->trans = NULL;
/* unlock db */
+ if(nolock) {
+ return(0);
+ }
if(handle->lckfd != -1) {
close(handle->lckfd);
handle->lckfd = -1;
--
1.5.3.8
More information about the pacman-dev
mailing list