tdb: Pass argument "header" to check_header_hash
authorVolker Lendecke <vl@samba.org>
Thu, 20 Dec 2012 15:14:23 +0000 (16:14 +0100)
committerStefan Metzmacher <metze@samba.org>
Tue, 5 Feb 2013 07:55:09 +0000 (08:55 +0100)
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
lib/tdb/common/open.c

index 6079463945074f4718bf78f1549cdd4285bf5679..6630d64eac233bd5df7fd8dd0b76e109b0838f75 100644 (file)
@@ -144,11 +144,12 @@ static void null_log_fn(struct tdb_context *tdb, enum tdb_debug_level level, con
 }
 
 static bool check_header_hash(struct tdb_context *tdb,
+                             struct tdb_header *header,
                              bool default_hash, uint32_t *m1, uint32_t *m2)
 {
        tdb_header_hash(tdb, m1, m2);
-       if (tdb->header.magic1_hash == *m1 &&
-           tdb->header.magic2_hash == *m2) {
+       if (header->magic1_hash == *m1 &&
+           header->magic2_hash == *m2) {
                return true;
        }
 
@@ -161,7 +162,7 @@ static bool check_header_hash(struct tdb_context *tdb,
                tdb->hash_fn = tdb_jenkins_hash;
        else
                tdb->hash_fn = tdb_old_hash;
-       return check_header_hash(tdb, false, m1, m2);
+       return check_header_hash(tdb, header, false, m1, m2);
 }
 
 _PUBLIC_ struct tdb_context *tdb_open_ex(const char *name, int hash_size, int tdb_flags,
@@ -387,7 +388,8 @@ _PUBLIC_ struct tdb_context *tdb_open_ex(const char *name, int hash_size, int td
        if ((tdb->header.magic1_hash == 0) && (tdb->header.magic2_hash == 0)) {
                /* older TDB without magic hash references */
                tdb->hash_fn = tdb_old_hash;
-       } else if (!check_header_hash(tdb, !hash_fn, &magic1, &magic2)) {
+       } else if (!check_header_hash(tdb, &tdb->header, !hash_fn,
+                                     &magic1, &magic2)) {
                TDB_LOG((tdb, TDB_DEBUG_FATAL, "tdb_open_ex: "
                         "%s was not created with %s hash function we are using\n"
                         "magic1_hash[0x%08X %s 0x%08X] "