From c5f82d3f6223ebd0c5cc0a07ea60393ae7284929 Mon Sep 17 00:00:00 2001 From: Panu Matilainen Date: Thu, 15 Dec 2016 14:21:48 +0200 Subject: [PATCH] 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. --- lib/rpmts.c | 5 +++++ 1 file changed, 5 insertions(+) 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 #include #include +#include #include #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); }