]> git.ozlabs.org Git - ccan/blobdiff - ccan/tdb2/test/run-57-die-during-transaction.c
tdb2: allow multiple chain locks.
[ccan] / ccan / tdb2 / test / run-57-die-during-transaction.c
index b6c3557ad5eea8934afb208f5d3096cbc2850405..84f01eb21a8dd009d5a6d738485f96e790822a55 100644 (file)
@@ -59,6 +59,7 @@ static void free_all(void)
 #define free free_noleak
 
 #include <ccan/tdb2/tdb.c>
+#include <ccan/tdb2/open.c>
 #include <ccan/tdb2/free.c>
 #include <ccan/tdb2/lock.c>
 #include <ccan/tdb2/io.c>
@@ -152,7 +153,7 @@ reset:
 
        if (setjmp(jmpbuf) != 0) {
                /* We're partway through.  Simulate our death. */
-               close(tdb->fd);
+               close(tdb->file->fd);
                forget_locking();
                in_transaction = false;
 
@@ -207,8 +208,7 @@ reset:
        }
 
        /* Put key for agent to fetch. */
-       key.dsize = strlen(KEY_STRING);
-       key.dptr = (void *)KEY_STRING;
+       key = tdb_mkdata(KEY_STRING, strlen(KEY_STRING));
        if (tdb_store(tdb, key, key, TDB_INSERT) != 0)
                return false;