From: Daniel Salzman Date: Wed, 20 Nov 2019 13:48:50 +0000 (+0100) Subject: knot: don't abort lmdb txn if commit failed X-Git-Tag: embedded_lmdb~106 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c90ea60ee619d3161fa356ef8936d247dc3f39fd;p=thirdparty%2Fknot-dns.git knot: don't abort lmdb txn if commit failed --- diff --git a/src/knot/journal/knot_lmdb.c b/src/knot/journal/knot_lmdb.c index 46dbf53e94..7b24710509 100644 --- a/src/knot/journal/knot_lmdb.c +++ b/src/knot/journal/knot_lmdb.c @@ -267,7 +267,7 @@ void knot_lmdb_abort(knot_lmdb_txn_t *txn) if (txn->opened) { if (txn->cursor != NULL) { mdb_cursor_close(txn->cursor); - txn->cursor = false; + txn->cursor = NULL; } mdb_txn_abort(txn->txn); txn->opened = false; @@ -293,15 +293,11 @@ void knot_lmdb_commit(knot_lmdb_txn_t *txn) } if (txn->cursor != NULL) { mdb_cursor_close(txn->cursor); - txn->cursor = false; + txn->cursor = NULL; } txn->ret = mdb_txn_commit(txn->txn); err_to_knot(&txn->ret); - if (txn->ret == KNOT_EOK) { - txn->opened = false; - } else { - knot_lmdb_abort(txn); - } + txn->opened = false; } // save the programmer's frequent checking for ENOMEM when creating search keys