From: Hallvard Furuseth Date: Wed, 9 Jul 2014 19:38:45 +0000 (+0200) Subject: Fix mdb_copy & co when MDB pagesize < OS pagesize X-Git-Tag: OPENLDAP_REL_ENG_2_4_40~71^2~2 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=6cb1166635de7812e57aa0a36c68a5c3e85b8284;p=openldap Fix mdb_copy & co when MDB pagesize < OS pagesize --- diff --git a/libraries/liblmdb/mdb.c b/libraries/liblmdb/mdb.c index 88120b90b4..3e62b2e28f 100644 --- a/libraries/liblmdb/mdb.c +++ b/libraries/liblmdb/mdb.c @@ -8410,13 +8410,13 @@ mdb_env_copyfd1(MDB_env *env, HANDLE fd) #ifdef _WIN32 my.mc_mutex = CreateMutex(NULL, FALSE, NULL); my.mc_cond = CreateEvent(NULL, FALSE, FALSE, NULL); - my.mc_wbuf[0] = _aligned_malloc(MDB_WBUF*2, env->me_psize); + my.mc_wbuf[0] = _aligned_malloc(MDB_WBUF*2, env->me_os_psize); if (my.mc_wbuf[0] == NULL) return errno; #else pthread_mutex_init(&my.mc_mutex, NULL); pthread_cond_init(&my.mc_cond, NULL); - rc = posix_memalign((void **)&my.mc_wbuf[0], env->me_psize, MDB_WBUF*2); + rc = posix_memalign((void **)&my.mc_wbuf[0], env->me_os_psize, MDB_WBUF*2); if (rc) return rc; #endif @@ -8654,6 +8654,7 @@ mdb_env_copy2(MDB_env *env, const char *path, unsigned int flags) goto leave; } + if (env->me_psize >= env->me_os_psize) { #ifdef O_DIRECT /* Set O_DIRECT if the file system supports it */ if ((rc = fcntl(newfd, F_GETFL)) != -1) @@ -8666,6 +8667,7 @@ mdb_env_copy2(MDB_env *env, const char *path, unsigned int flags) goto leave; } #endif + } rc = mdb_env_copyfd2(env, newfd, flags);