tdb: fix transaction recovery area for converted tdbs.
authorRusty Russell <rusty@rustcorp.com.au>
Mon, 18 Apr 2011 12:45:11 +0000 (22:15 +0930)
committerRusty Russell <rusty@rustcorp.com.au>
Mon, 18 Apr 2011 12:45:11 +0000 (22:15 +0930)
This is why macros are dangerous; these were converting the pointers, not the
things pointed to!

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
lib/tdb/common/transaction.c

index c49de3877cccca7c4fcef4b3f9cc8a4f4a962d86..4bc8044219fcd2de06be6576ac25c4695f3fb587 100644 (file)
@@ -786,7 +786,7 @@ static int transaction_setup_recovery(struct tdb_context *tdb,
        rec->data_len = recovery_size;
        rec->rec_len  = recovery_max_size;
        rec->key_len  = old_map_size;
-       CONVERT(rec);
+       CONVERT(*rec);
 
        /* build the recovery data into a single blob to allow us to do a single
           large write, which should be more efficient */
@@ -833,7 +833,9 @@ static int transaction_setup_recovery(struct tdb_context *tdb,
        /* and the tailer */
        tailer = sizeof(*rec) + recovery_max_size;
        memcpy(p, &tailer, 4);
-       CONVERT(p);
+       if (DOCONV()) {
+               tdb_convert(p, 4);
+       }
 
        /* write the recovery data to the recovery area */
        if (methods->tdb_write(tdb, recovery_offset, data, sizeof(*rec) + recovery_size) == -1) {