]> git.ozlabs.org Git - ccan/blobdiff - ccan/tdb2/test/run-tdb1-3G-file.c
tdb2: Make tdb1 use the tdb_file structure.
[ccan] / ccan / tdb2 / test / run-tdb1-3G-file.c
index 6121b4de48f7ee35693b220d9e5729d2dad4269f..43e9f2ad9bd831f847acfe954ab3e6305315b207 100644 (file)
@@ -15,12 +15,12 @@ static int tdb1_expand_file_sparse(struct tdb1_context *tdb,
                return -1;
        }
 
-       if (ftruncate(tdb->fd, size+addition) == -1) {
+       if (ftruncate(tdb->file->fd, size+addition) == -1) {
                char b = 0;
-               ssize_t written = pwrite(tdb->fd,  &b, 1, (size+addition) - 1);
+               ssize_t written = pwrite(tdb->file->fd,  &b, 1, (size+addition) - 1);
                if (written == 0) {
                        /* try once more, potentially revealing errno */
-                       written = pwrite(tdb->fd,  &b, 1, (size+addition) - 1);
+                       written = pwrite(tdb->file->fd,  &b, 1, (size+addition) - 1);
                }
                if (written == 0) {
                        /* again - give up, guessing errno */
@@ -66,7 +66,7 @@ int main(int argc, char *argv[])
        struct tdb1_record rec;
 
        plan_tests(24);
-       tdb = tdb1_open_ex("run-36-file.tdb", 1024, TDB1_CLEAR_IF_FIRST,
+       tdb = tdb1_open_ex("run-36-file.tdb", 1024, TDB_DEFAULT,
                          O_CREAT|O_TRUNC|O_RDWR, 0600, &taplogctx, NULL);
 
        ok1(tdb);