]> git.ozlabs.org Git - ccan/blobdiff - ccan/tdb2/tdb.c
tdb2: unify tdb1_store into tdb_store
[ccan] / ccan / tdb2 / tdb.c
index 329a643f5145ac6c452fd2c08e56359a52e405dc..a7aa4572382b0f8b10ef03c4adc08599fd7e7293 100644 (file)
@@ -114,6 +114,12 @@ enum TDB_ERROR tdb_store(struct tdb_context *tdb,
        struct tdb_used_record rec;
        enum TDB_ERROR ecode;
 
+       if (tdb->flags & TDB_VERSION1) {
+               if (tdb1_store(tdb, key, dbuf, flag) == -1)
+                       return tdb->last_error;
+               return TDB_SUCCESS;
+       }
+
        off = find_and_lock(tdb, key, F_WRLCK, &h, &rec, NULL);
        if (TDB_OFF_IS_ERR(off)) {
                return tdb->last_error = off;