From 94af9e02b08bbe30fef425bb39f56cb9446681ac Mon Sep 17 00:00:00 2001 From: Leo Yuriev Date: Mon, 24 Jul 2017 15:04:54 +0300 Subject: [PATCH] mdbx: fix mdbx_env_close_ex() for MDBX_RDONLY. Change-Id: I5ff79a93e026d4b40412294956dd222081a1b821 --- src/mdbx.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mdbx.c b/src/mdbx.c index 83d41a23..504811f8 100644 --- a/src/mdbx.c +++ b/src/mdbx.c @@ -5123,8 +5123,8 @@ int __cold mdbx_env_close_ex(MDBX_env *env, int dont_sync) { if (unlikely(env->me_signature != MDBX_ME_SIGNATURE)) return MDBX_EBADSIGN; - if (!dont_sync && env->me_lck) - rc = mdbx_env_sync(env, 1); + if (!dont_sync && !(env->me_flags & MDBX_RDONLY)) + rc = mdbx_env_sync(env, true); VALGRIND_DESTROY_MEMPOOL(env); while ((dp = env->me_dpages) != NULL) {