From ea30be6109d6abdc6c67db312cd61ea6c9753820 Mon Sep 17 00:00:00 2001 From: Kris Zyp Date: Wed, 6 Feb 2019 13:49:27 -0700 Subject: [PATCH] ITS#8975 WIN32: Skip setting file pointer for write maps CreateFileMapping already takes care of it. --- libraries/liblmdb/mdb.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libraries/liblmdb/mdb.c b/libraries/liblmdb/mdb.c index 22740ce..1e71e3b 100644 --- a/libraries/liblmdb/mdb.c +++ b/libraries/liblmdb/mdb.c @@ -3991,9 +3991,9 @@ mdb_env_map(MDB_env *env, void *addr) * and won't map more than the file size. * Just set the maxsize right now. */ - if (SetFilePointer(env->me_fd, sizelo, &sizehi, 0) != (DWORD)sizelo + if (!(flags & MDB_WRITEMAP) && (SetFilePointer(env->me_fd, sizelo, &sizehi, 0) != (DWORD)sizelo || !SetEndOfFile(env->me_fd) - || SetFilePointer(env->me_fd, 0, NULL, 0) != 0) + || SetFilePointer(env->me_fd, 0, NULL, 0) != 0)) return ErrCode(); }