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.
This commit is contained in:
Panu Matilainen 2016-12-15 14:21:48 +02:00
parent 12ea4ed2bd
commit c5f82d3f62
1 changed files with 5 additions and 0 deletions

View File

@ -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);
}