]> git.ozlabs.org Git - ccan/blobdiff - ccan/tdb2/check.c
tdb2: fix prototypes which return enum TDB_ERROR.
[ccan] / ccan / tdb2 / check.c
index 6d846f414264404255eac5f67d0c93ea824b219b..a8b5b3d558c04e2943912d77b7b558e3cd609499 100644 (file)
@@ -436,7 +436,7 @@ fail:
 static enum TDB_ERROR check_hash(struct tdb_context *tdb,
                                 tdb_off_t used[],
                                 size_t num_used, size_t num_ftables,
-                                int (*check)(TDB_DATA, TDB_DATA, void *),
+                                enum TDB_ERROR (*check)(TDB_DATA, TDB_DATA, void *),
                                 void *data)
 {
        /* Free tables also show up as used. */
@@ -782,6 +782,12 @@ enum TDB_ERROR tdb_check_(struct tdb_context *tdb,
        uint64_t features;
        enum TDB_ERROR ecode;
 
+       if (tdb->flags & TDB_VERSION1) {
+               if (tdb1_check(tdb, check, data) == -1)
+                       return tdb->last_error;
+               return TDB_SUCCESS;
+       }
+
        ecode = tdb_allrecord_lock(tdb, F_RDLCK, TDB_LOCK_WAIT, false);
        if (ecode != TDB_SUCCESS) {
                return tdb->last_error = ecode;