tdb: fix tdb_check() on other-endian tdbs.
authorRusty Russell <rusty@rustcorp.com.au>
Mon, 13 Sep 2010 10:29:18 +0000 (19:59 +0930)
committerRusty Russell <rusty@rustcorp.com.au>
Thu, 7 Oct 2010 04:35:58 +0000 (15:05 +1030)
We must not endian-convert the magic string, just the rest.

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

index 3ac2eb51053943b17ae0b440a7dcda08ce128f39..fd3c0a91f38348a17291d6fd3ef623ec288947d7 100644 (file)
@@ -29,7 +29,7 @@ static bool tdb_check_header(struct tdb_context *tdb, tdb_off_t *recovery)
 {
        struct tdb_header hdr;
 
-       if (tdb->methods->tdb_read(tdb, 0, &hdr, sizeof(hdr), DOCONV()) == -1)
+       if (tdb->methods->tdb_read(tdb, 0, &hdr, sizeof(hdr), 0) == -1)
                return false;
        if (strcmp(hdr.magic_food, TDB_MAGIC_FOOD) != 0)
                goto corrupt;