X-Git-Url: https://git.ozlabs.org/?p=ccan;a=blobdiff_plain;f=ccan%2Ftdb2%2Ftest%2Frun-remap-in-read_traverse.c;h=b70a841aaf8027de24e6bff052aa4ff77b0694ca;hp=5c473cbe1beab9b40e9453313bc39307e6b67aba;hb=98c754ffe65bc335f66161d6cc8705d4ea2710ec;hpb=b24f8e2ae5ac22fc2e5dbfebebf9c5fa2f338588 diff --git a/ccan/tdb2/test/run-remap-in-read_traverse.c b/ccan/tdb2/test/run-remap-in-read_traverse.c index 5c473cbe..b70a841a 100644 --- a/ccan/tdb2/test/run-remap-in-read_traverse.c +++ b/ccan/tdb2/test/run-remap-in-read_traverse.c @@ -1,13 +1,6 @@ +#include "tdb2-source.h" /* We had a bug where we marked the tdb read-only for a tdb_traverse_read. * If we then expanded the tdb, we would remap read-only, and later SEGV. */ -#include -#include -#include -#include -#include -#include -#include -#include #include #include "external-agent.h" #include "logging.h" @@ -39,7 +32,7 @@ int main(int argc, char *argv[]) unsigned int i; struct agent *agent; struct tdb_context *tdb; - struct tdb_data d = { (unsigned char *)"hello", 5 }; + struct tdb_data d = tdb_mkdata("hello", 5); const char filename[] = "run-remap-in-read_traverse.tdb"; plan_tests(4); @@ -50,7 +43,7 @@ int main(int argc, char *argv[]) O_RDWR|O_CREAT|O_TRUNC, 0600, &tap_log_attr); ok1(external_agent_operation(agent, OPEN, filename) == SUCCESS); - i = add_records_to_grow(agent, tdb->fd, tdb->map_size); + i = add_records_to_grow(agent, tdb->file->fd, tdb->file->map_size); /* Do a traverse. */ ok1(tdb_traverse(tdb, NULL, NULL) == i); @@ -58,6 +51,7 @@ int main(int argc, char *argv[]) /* Now store something! */ ok1(tdb_store(tdb, d, d, TDB_INSERT) == 0); ok1(tap_log_messages == 0); + tdb_close(tdb); free_external_agent(agent); return exit_status(); }