X-Git-Url: http://git.ozlabs.org/?a=blobdiff_plain;f=ccan%2Ftdb2%2Ftest%2Frun-57-die-during-transaction.c;h=84f01eb21a8dd009d5a6d738485f96e790822a55;hb=0468e6992770e5082f2fb11cd93c2d8209e3f351;hp=793636a9f6e9c0b30d9fbabfd358febb8bb1efb2;hpb=c56e2b1b5e51b094d53f4012e226b352a91618f6;p=ccan diff --git a/ccan/tdb2/test/run-57-die-during-transaction.c b/ccan/tdb2/test/run-57-die-during-transaction.c index 793636a9..84f01eb2 100644 --- a/ccan/tdb2/test/run-57-die-during-transaction.c +++ b/ccan/tdb2/test/run-57-die-during-transaction.c @@ -1,4 +1,4 @@ -#define _XOPEN_SOURCE 500 +#include "config.h" #include #include "lock-tracking.h" #include @@ -59,6 +59,7 @@ static void free_all(void) #define free free_noleak #include +#include #include #include #include @@ -145,10 +146,14 @@ reset: unlink(TEST_DBNAME); tdb = tdb_open(TEST_DBNAME, TDB_NOMMAP, O_CREAT|O_TRUNC|O_RDWR, 0600, &tap_log_attr); + if (!tdb) { + diag("Failed opening TDB: %s", strerror(errno)); + return false; + } if (setjmp(jmpbuf) != 0) { /* We're partway through. Simulate our death. */ - close(tdb->fd); + close(tdb->file->fd); forget_locking(); in_transaction = false; @@ -203,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;