tdb: Fix a "increases alignment" warning
[samba.git] / lib / tdb / test / run-traverse-in-transaction.c
index bcdc3545cd5b27148e8d118c0d4e95977a4d3470..d187b9b58b8d1f50104f965c5b466e1163563301 100644 (file)
@@ -11,6 +11,7 @@
 #include "../common/open.c"
 #include "../common/check.c"
 #include "../common/hash.c"
+#include "../common/mutex.c"
 #include "tap-interface.h"
 #undef fcntl_with_lockcheck
 #include <stdlib.h>
@@ -54,15 +55,17 @@ int main(int argc, char *argv[])
        ok1(tdb);
 
        key.dsize = strlen("hi");
-       key.dptr = (void *)"hi";
-       data.dptr = (void *)"world";
+       key.dptr = discard_const_p(uint8_t, "hi");
+       data.dptr = discard_const_p(uint8_t, "world");
        data.dsize = strlen("world");
 
        ok1(tdb_store(tdb, key, data, TDB_INSERT) == 0);
 
        ok1(external_agent_operation(agent, OPEN, tdb_name(tdb)) == SUCCESS);
 
+       ok1(tdb_transaction_active(tdb) == 0);
        ok1(tdb_transaction_start(tdb) == 0);
+       ok1(tdb_transaction_active(tdb) == 1);
        ok1(external_agent_operation(agent, TRANSACTION_START, tdb_name(tdb))
            == WOULD_HAVE_BLOCKED);
        tdb_traverse(tdb, traverse, NULL);
@@ -76,6 +79,7 @@ int main(int argc, char *argv[])
        ok1(external_agent_operation(agent, TRANSACTION_START, tdb_name(tdb))
            == WOULD_HAVE_BLOCKED);
        ok1(tdb_transaction_commit(tdb) == 0);
+       ok1(tdb_transaction_active(tdb) == 0);
        /* Now we should be fine. */
        ok1(external_agent_operation(agent, TRANSACTION_START, tdb_name(tdb))
            == SUCCESS);