tdb: fix tbdtool list freelist output
authorRalph Boehme <slow@samba.org>
Sun, 9 Jul 2017 16:39:27 +0000 (18:39 +0200)
committerJeremy Allison <jra@samba.org>
Tue, 22 Aug 2017 21:32:13 +0000 (23:32 +0200)
Due to the non-fixable bug in the BUCKET macro tdbtool list printed some
other hash chainlist, not the freelist.

Bug: https://bugzilla.samba.org/show_bug.cgi?id=12888

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
lib/tdb/common/dump.c

index 5f6a78b2c8ec9888d323aaf77a5ea6fdaefbc5c3..73286b8735071f0062e9b50f34b9a343361e62fc 100644 (file)
@@ -62,7 +62,11 @@ static int tdb_dump_chain(struct tdb_context *tdb, int i)
 {
        tdb_off_t rec_ptr, top;
 
-       top = TDB_HASH_TOP(i);
+       if (i == -1) {
+               top = FREELIST_TOP;
+       } else {
+               top = TDB_HASH_TOP(i);
+       }
 
        if (tdb_lock(tdb, i, F_WRLCK) != 0)
                return -1;