tdb: Fix a missing CONVERT
authorVolker Lendecke <vl@samba.org>
Tue, 11 Dec 2012 20:04:58 +0000 (21:04 +0100)
committerStefan Metzmacher <metze@samba.org>
Fri, 21 Dec 2012 10:54:33 +0000 (11:54 +0100)
methods->tdb_write expects data in on-disk format. For reading that
record, methods->tdb_read() has taken care of the on-disk to in-memory
representation according to the DOCONV() flag passed down. tdb_rec_write()
is a wrapper around methods->tdb_write just doing the CONVERT() on the
way to disk.

Reviewed-by: Rusty Russell <rusty@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
lib/tdb/common/freelist.c

index 6358f64a04ab8db19693b05e6f84f282c44c348e..5312c2a978e8093c97d9c18b0034354cdfc99b6f 100644 (file)
@@ -45,7 +45,7 @@ int tdb_rec_free_read(struct tdb_context *tdb, tdb_off_t off, struct tdb_record
                TDB_LOG((tdb, TDB_DEBUG_WARNING, "tdb_rec_free_read non-free magic 0x%x at offset=%d - fixing\n", 
                         rec->magic, off));
                rec->magic = TDB_FREE_MAGIC;
-               if (tdb->methods->tdb_write(tdb, off, rec, sizeof(*rec)) == -1)
+               if (tdb_rec_write(tdb, off, rec) == -1)
                        return -1;
        }