]> git.ipfire.org Git - thirdparty/knot-dns.git/commitdiff
knot: don't abort lmdb txn if commit failed
authorDaniel Salzman <daniel.salzman@nic.cz>
Wed, 20 Nov 2019 13:48:50 +0000 (14:48 +0100)
committerDaniel Salzman <daniel.salzman@nic.cz>
Thu, 21 Nov 2019 14:41:04 +0000 (15:41 +0100)
src/knot/journal/knot_lmdb.c

index 46dbf53e9475839ca570b7d49c6fd1539da4566a..7b247105093df997cdbc91a5c5019de71a89a04b 100644 (file)
@@ -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