mdbx: fix mdbx_read_header().

This commit is contained in:
Leo Yuriev 2017-04-27 18:06:07 +03:00
parent 82f053a685
commit 4e9b734b52

View File

@ -3275,9 +3275,9 @@ fail:
* before mapping it into memory. */ * before mapping it into memory. */
static int __cold mdbx_read_header(MDB_env *env, MDB_meta *meta) { static int __cold mdbx_read_header(MDB_env *env, MDB_meta *meta) {
assert(offsetof(MDB_metabuf, mb_metabuf.mm_meta) == PAGEHDRSZ); assert(offsetof(MDB_metabuf, mb_metabuf.mm_meta) == PAGEHDRSZ);
memset(meta, 0, sizeof(MDB_meta));
meta->mm_datasync_sign = MDB_DATASIGN_WEAK; meta->mm_datasync_sign = MDB_DATASIGN_WEAK;
meta->mm_txnid = 0; unsigned offset = 0;
off_t offset = 0;
/* Read both meta pages so we can use the latest one. */ /* Read both meta pages so we can use the latest one. */
for (int loops_left = 2; --loops_left >= 0;) { for (int loops_left = 2; --loops_left >= 0;) {