]> git.ozlabs.org Git - ccan/blobdiff - ccan/tdb2/check.c
ccan_tokenizer: 64-bit compile fixes.
[ccan] / ccan / tdb2 / check.c
index 1ce75be065f4317b1e63a4c2bc1afb47e446478b..c2ca95d08bcddfa98444d3d1354987c8168ce19a 100644 (file)
@@ -287,8 +287,8 @@ static bool check_free(struct tdb_context *tdb,
                return false;
        }
        if (tdb->methods->oob(tdb, off
-                             + frec->data_len-sizeof(struct tdb_used_record),
-                             true))
+                             + frec->data_len+sizeof(struct tdb_used_record),
+                             false))
                return false;
        if (off < zone_off || off >= zone_off + (1ULL<<frec_zone_bits(frec))) {
                tdb->log(tdb, TDB_DEBUG_ERROR, tdb->log_priv,
@@ -336,11 +336,11 @@ static tdb_len_t check_free_list(struct tdb_context *tdb,
                h = bucket_off(zone_off, i);
                for (off = tdb_read_off(tdb, h); off; off = f.next) {
                        if (off == TDB_OFF_ERR)
-                               return false;
+                               return TDB_OFF_ERR;
                        if (tdb_read_convert(tdb, off, &f, sizeof(f)))
-                               return false;
+                               return TDB_OFF_ERR;
                        if (!check_free(tdb, off, &f, prev, zone_off, i))
-                               return false;
+                               return TDB_OFF_ERR;
 
                        /* FIXME: Check hash bits */
                        p = asearch(&off, free, num_free, off_cmp);
@@ -350,7 +350,7 @@ static tdb_len_t check_free_list(struct tdb_context *tdb,
                                         "tdb_check: Invalid offset"
                                         " %llu in free table\n",
                                         (long long)off);
-                               return false;
+                               return TDB_OFF_ERR;
                        }
                        /* Mark it invalid. */
                        *p ^= 1;
@@ -487,7 +487,6 @@ int tdb_check(struct tdb_context *tdb,
        unsigned max_zone_bits = INITIAL_ZONE_BITS;
        uint8_t tailer;
 
-       /* This always ensures the header is uptodate. */
        if (tdb_allrecord_lock(tdb, F_RDLCK, TDB_LOCK_WAIT, false) != 0)
                return -1;