From 0350fc41f8a3b362e50fd3b4caa4c40a486b76f9 Mon Sep 17 00:00:00 2001 From: Leonid Yuriev Date: Thu, 19 Dec 2019 19:49:58 +0300 Subject: [PATCH] mdbx: clean copy for undo meta. Change-Id: I2abc1d701dc52caa268210489aa27803fd7a2c3b --- src/elements/core.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/elements/core.c b/src/elements/core.c index 0265223d..230ff11a 100644 --- a/src/elements/core.c +++ b/src/elements/core.c @@ -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; }