From 8861f1377cd2e0162261157835824bb6338a3d37 Mon Sep 17 00:00:00 2001 From: Leonid Yuriev Date: Fri, 11 Oct 2019 13:21:38 +0300 Subject: [PATCH] mdbx: roundup buffer size inside env_copy2fd(). Change-Id: Iaa9d1adb934d36a28be3804683ffbaf43552d54b --- src/elements/core.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/elements/core.c b/src/elements/core.c index 5b185d39..d6a81a00 100644 --- a/src/elements/core.c +++ b/src/elements/core.c @@ -13087,8 +13087,9 @@ int __cold mdbx_env_copy2fd(MDBX_env *env, mdbx_filehandle_t fd, } const size_t buffer_size = - pgno2bytes(env, NUM_METAS) + - ((flags & MDBX_CP_COMPACT) ? MDBX_WBUF * 2 : MDBX_WBUF); + mdbx_roundup2(pgno2bytes(env, NUM_METAS) + + ((flags & MDBX_CP_COMPACT) ? MDBX_WBUF * 2 : MDBX_WBUF), + env->me_os_psize); uint8_t *buffer = NULL; int rc = mdbx_memalign_alloc(env->me_os_psize, buffer_size, (void **)&buffer);