]> the.earth.li Git - onak.git/commitdiff
Don't end an existing transaction if trying to delete a non-existent key
authorJonathan McDowell <noodles@earth.li>
Wed, 20 Nov 2013 02:44:39 +0000 (18:44 -0800)
committerJonathan McDowell <noodles@earth.li>
Wed, 20 Nov 2013 02:44:39 +0000 (18:44 -0800)
The DB4 key deletion routine would always exit the current transaction
if the key wasn't found, even if it had been called by another function
which had entered the transaction. Only do so if the deletion routine
itself is what caused the transaction to be started.

keydb_db4.c

index 43f16741bad0d931dc36ad4e50d2eff778572236..b36ce3f65dba9e18408c0b86c6e6f35c72600f6b 100644 (file)
@@ -772,7 +772,9 @@ static int db4_delete_key(struct onak_dbctx *dbctx,
        }
 
        if (db4_fetch_key_id(dbctx, keyid, &publickey, true) == 0) {
-               db4_endtrans(dbctx);
+               if (!intrans) {
+                       db4_endtrans(dbctx);
+               }
                return 1;
        }