summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPanu Matilainen <pmatilai@redhat.com>2016-12-15 14:21:48 +0200
committerPanu Matilainen <pmatilai@redhat.com>2016-12-15 14:21:48 +0200
commitc5f82d3f6223ebd0c5cc0a07ea60393ae7284929 (patch)
tree96a61e5fe4377f9c1aca308d77e87602fd97fb84
parent12ea4ed2bd71ae53a49ac861498f33afaa498e65 (diff)
downloadrpm-c5f82d3f6223ebd0c5cc0a07ea60393ae7284929.tar.gz
Block signals during RPMTXN_WRITE transactions
This includes (but not limited to) rpmtsRun() during which the accidental ctrl-c no longer aborts the whole dang thing. This could've of course been done without all the other recent signal infra too, but now that it's all neatly (yeah, right...) wrapped inside rpmsq instead of being littered all over town its nicer to do.
-rw-r--r--lib/rpmts.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/rpmts.c b/lib/rpmts.c
index 3f8f8808c..c07f15d90 100644
--- a/lib/rpmts.c
+++ b/lib/rpmts.c
@@ -19,6 +19,7 @@
#include <rpm/rpmds.h>
#include <rpm/rpmfi.h>
#include <rpm/rpmlog.h>
+#include <rpm/rpmsq.h>
#include <rpm/rpmte.h>
#include "rpmio/digest.h"
@@ -1143,6 +1144,8 @@ rpmtxn rpmtxnBegin(rpmts ts, rpmtxnFlags flags)
txn->lock = ts->lock;
txn->flags = flags;
txn->ts = rpmtsLink(ts);
+ if (txn->flags & RPMTXN_WRITE)
+ rpmsqBlock(SIG_BLOCK);
}
return txn;
@@ -1152,6 +1155,8 @@ rpmtxn rpmtxnEnd(rpmtxn txn)
{
if (txn) {
rpmlockRelease(txn->lock);
+ if (txn->flags & RPMTXN_WRITE)
+ rpmsqBlock(SIG_UNBLOCK);
rpmtsFree(txn->ts);
free(txn);
}