- fix: no transaction lock if --test was specified (#119783).
authorjbj <devnull@localhost>
Wed, 7 Apr 2004 23:50:35 +0000 (23:50 +0000)
committerjbj <devnull@localhost>
Wed, 7 Apr 2004 23:50:35 +0000 (23:50 +0000)
CVS patchset: 7222
CVS date: 2004/04/07 23:50:35

CHANGES
lib/transaction.c

diff --git a/CHANGES b/CHANGES
index 716520a..6e49f2a 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -11,6 +11,7 @@
        - python: hide labelCompare() underneath ds.cmp(a,b).
        - fix: segfault on --recontext if file_contexts unreadable (#117374).
        - fix: /etc/security/selinux/file_contexts is default path.
+       - fix: no transaction lock if --test was specified (#119783).
 
 4.2.2 -> 4.3:
        - upgrade to zlib-1.2.beta7.
index a078615..240c0c1 100644 (file)
@@ -1366,7 +1366,7 @@ int rpmtsRun(rpmts ts, rpmps okProbs, rpmprobFilterFlags ignoreSet)
     int numRemoved;
     rpmts rollbackTransaction = NULL;
     int rollbackOnFailure = 0;
-    void * lock;
+    void * lock = NULL;
     int xx;
 
 
@@ -1382,13 +1382,15 @@ int rpmtsRun(rpmts ts, rpmps okProbs, rpmprobFilterFlags ignoreSet)
        rollbackOnFailure = 0;
     }
     /* If we are in test mode, there is no need to rollback on
-     * failure (-;
+     * failure, nor acquire the transaction lock.
      */
-    if (rpmtsFlags(ts) & RPMTRANS_FLAG_TEST) rollbackOnFailure = 0;
-
-    lock = rpmtsAcquireLock(ts);
-    if (lock == NULL)
-       return -1;      /* XXX W2DO? */
+    if (rpmtsFlags(ts) & RPMTRANS_FLAG_TEST) {
+       rollbackOnFailure = 0;
+    } else {
+       lock = rpmtsAcquireLock(ts);
+       if (lock == NULL)
+           return -1;  /* XXX W2DO? */
+    }
 
     if (rpmtsFlags(ts) & RPMTRANS_FLAG_NOSCRIPTS)
        (void) rpmtsSetFlags(ts, (rpmtsFlags(ts) | _noTransScripts | _noTransTriggers));
@@ -1462,7 +1464,7 @@ rpmMessage(RPMMESS_DEBUG, _("sanity checking %d elements\n"), rpmtsNElements(ts)
                        rpmteO(p), NULL,
                        NULL, 0);
 
-       if (!(rpmtsFilterFlags(ts) & RPMPROB_FILTER_OLDPACKAGE)) {
+        if (!(rpmtsFilterFlags(ts) & RPMPROB_FILTER_OLDPACKAGE)) {
            Header h;
            mi = rpmtsInitIterator(ts, RPMTAG_NAME, rpmteN(p), 0);
            while ((h = rpmdbNextIterator(mi)) != NULL)