mdbx: clean copy for undo meta.

Change-Id: I2abc1d701dc52caa268210489aa27803fd7a2c3b
This commit is contained in:
Leonid Yuriev 2019-12-19 19:49:58 +03:00
parent edbdb682d5
commit 0350fc41f8

View File

@ -7679,6 +7679,7 @@ static int mdbx_sync_locked(MDBX_env *env, unsigned flags,
}
}
} else {
const MDBX_meta undo_meta = *target;
const mdbx_filehandle_t fd = (env->me_dsync_fd != INVALID_HANDLE_VALUE)
? env->me_dsync_fd
: env->me_lazy_fd;
@ -7689,7 +7690,7 @@ static int mdbx_sync_locked(MDBX_env *env, unsigned flags,
mdbx_debug("%s", "write failed, disk error?");
/* On a failure, the pagecache still contains the new data.
* Try write some old data back, to prevent it from being used. */
mdbx_pwrite(fd, (void *)target, sizeof(MDBX_meta),
mdbx_pwrite(fd, &undo_meta, sizeof(MDBX_meta),
(uint8_t *)target - env->me_map);
goto fail;
}