Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/lib/libalpm/trans.c
diff options
context:
space:
mode:
authorAndrew Gregory <andrew.gregory.8@gmail.com>2016-02-22 14:07:57 -0500
committerAllan McRae <allan@archlinux.org>2016-02-23 12:41:36 +1000
commita724235b6127f9655708614d1e44f9b5c661a506 (patch)
tree6b4ef62ae28bc340db7ca5b2d628a60e3a15363a /lib/libalpm/trans.c
parent1d6583a58da0904fb7feafd4a666391087955a7b (diff)
make alpm_unlock and trans_interrupt async safe
RET_ERR calls _alpm_log which includes calls that are not safe for use in asynchronous signal handlers (see signal(7)). Replace it in functions called from our signal handlers with a new macro RET_ERR_ASYNC_SAFE which is identical except that it lacks the call to _alpm_log. Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Diffstat (limited to 'lib/libalpm/trans.c')
-rw-r--r--lib/libalpm/trans.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/libalpm/trans.c b/lib/libalpm/trans.c
index 239d6a14..13984707 100644
--- a/lib/libalpm/trans.c
+++ b/lib/libalpm/trans.c
@@ -233,7 +233,9 @@ int SYMEXPORT alpm_trans_commit(alpm_handle_t *handle, alpm_list_t **data)
return 0;
}
-/** Interrupt a transaction. */
+/** Interrupt a transaction.
+ * @note Safe to call from inside signal handlers.
+ */
int SYMEXPORT alpm_trans_interrupt(alpm_handle_t *handle)
{
alpm_trans_t *trans;
@@ -242,9 +244,9 @@ int SYMEXPORT alpm_trans_interrupt(alpm_handle_t *handle)
CHECK_HANDLE(handle, return -1);
trans = handle->trans;
- ASSERT(trans != NULL, RET_ERR(handle, ALPM_ERR_TRANS_NULL, -1));
+ ASSERT(trans != NULL, RET_ERR_ASYNC_SAFE(handle, ALPM_ERR_TRANS_NULL, -1));
ASSERT(trans->state == STATE_COMMITING || trans->state == STATE_INTERRUPTED,
- RET_ERR(handle, ALPM_ERR_TRANS_TYPE, -1));
+ RET_ERR_ASYNC_SAFE(handle, ALPM_ERR_TRANS_TYPE, -1));
trans->state = STATE_INTERRUPTED;