From aa859cd9b0034a3e54e422868018e1714b743156 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sat, 7 Jul 2018 12:16:02 +0300 Subject: merge of fix into libdbmx that could create broken profiles --- plugins/Dbx_mdbx/src/dbintf.cpp | 4 ++-- plugins/Dbx_mdbx/src/libmdbx/src/mdbx.c | 6 +++--- plugins/Dbx_mdbx/src/libmdbx/src/osal.c | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) (limited to 'plugins') diff --git a/plugins/Dbx_mdbx/src/dbintf.cpp b/plugins/Dbx_mdbx/src/dbintf.cpp index a293b2f84a..9c659c5593 100644 --- a/plugins/Dbx_mdbx/src/dbintf.cpp +++ b/plugins/Dbx_mdbx/src/dbintf.cpp @@ -183,7 +183,7 @@ BOOL CDbxMDBX::Compact() } mir_cslock lck(m_csDbAccess); - int res = mdbx_env_copy2fd(m_env, pFile, /*MDBX_CP_COMPACT*/0); + int res = mdbx_env_copy2fd(m_env, pFile, MDBX_CP_COMPACT); CloseHandle(pFile); if (res == MDBX_SUCCESS) { @@ -208,7 +208,7 @@ BOOL CDbxMDBX::Backup(const wchar_t *pwszPath) return 1; } - int res = mdbx_env_copy2fd(m_env, pFile, 0); + int res = mdbx_env_copy2fd(m_env, pFile, MDBX_CP_COMPACT); CloseHandle(pFile); if (res == MDBX_SUCCESS) return 0; diff --git a/plugins/Dbx_mdbx/src/libmdbx/src/mdbx.c b/plugins/Dbx_mdbx/src/libmdbx/src/mdbx.c index 042d6079d4..ad55a98f81 100644 --- a/plugins/Dbx_mdbx/src/libmdbx/src/mdbx.c +++ b/plugins/Dbx_mdbx/src/libmdbx/src/mdbx.c @@ -5793,7 +5793,7 @@ int __cold mdbx_env_open(MDBX_env *env, const char *path, unsigned flags, } const uint32_t saved_me_flags = env->me_flags; - env->me_flags = flags | MDBX_ENV_ACTIVE; + env->me_flags = (flags & ~MDBX_FATAL_ERROR) | MDBX_ENV_ACTIVE; if (rc) goto bailout; @@ -5915,7 +5915,7 @@ int __cold mdbx_env_open(MDBX_env *env, const char *path, unsigned flags, bailout: if (rc) { mdbx_env_close0(env); - env->me_flags = saved_me_flags; + env->me_flags = saved_me_flags | MDBX_FATAL_ERROR; } free(lck_pathname); return rc; @@ -10448,8 +10448,8 @@ static int __cold mdbx_env_compact(MDBX_env *env, mdbx_filehandle_t fd) { /* update signature */ meta->mp_meta.mm_datasync_sign = mdbx_meta_sign(&meta->mp_meta); + memcpy(ctx.mc_wbuf[0], buffer, ctx.mc_wlen[0] = pgno2bytes(env, NUM_METAS)); - ctx.mc_wlen[0] = pgno2bytes(env, NUM_METAS); ctx.mc_txn = txn; rc = mdbx_env_cwalk(&ctx, &root, 0); if (rc == MDBX_SUCCESS && root != new_root) { diff --git a/plugins/Dbx_mdbx/src/libmdbx/src/osal.c b/plugins/Dbx_mdbx/src/libmdbx/src/osal.c index 159fba965d..738a179465 100644 --- a/plugins/Dbx_mdbx/src/libmdbx/src/osal.c +++ b/plugins/Dbx_mdbx/src/libmdbx/src/osal.c @@ -191,7 +191,7 @@ __cold void mdbx_panic(const char *fmt, ...) { abort(); } - /*----------------------------------------------------------------------------*/ +/*----------------------------------------------------------------------------*/ #ifndef mdbx_asprintf int mdbx_asprintf(char **strp, const char *fmt, ...) { -- cgit v1.2.3