From: Howard Chu Date: Sun, 6 Dec 2015 20:54:23 +0000 (+0000) Subject: ITS#8324 additional tweaks X-Git-Tag: accepted/tizen/5.0/unified/20181102.030725~124 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=c4e31434c7773ee54f2ffdeb545e5740f56492a1;p=platform%2Fupstream%2Flmdb.git ITS#8324 additional tweaks VirtualAlloc is only needed with WRITEMAP. Regular writes already extend the mmap implictly. --- diff --git a/libraries/liblmdb/mdb.c b/libraries/liblmdb/mdb.c index 6c88c96..09f1509 100644 --- a/libraries/liblmdb/mdb.c +++ b/libraries/liblmdb/mdb.c @@ -2324,7 +2324,7 @@ mdb_page_alloc(MDB_cursor *mc, int num, MDB_page **mp) goto fail; } #ifdef _WIN32 - { + if (env->me_flags & MDB_WRITEMAP) { void *p; p = (MDB_page *)(env->me_map + env->me_psize * pgno); p = VirtualAlloc(p, env->me_psize * num, MEM_COMMIT, @@ -4260,7 +4260,8 @@ mdb_env_open2(MDB_env *env) /* For FIXEDMAP, make sure the file is non-empty before we attempt to map it */ if (newenv) { char dummy = 0; - rc = WriteFile(env->me_fd, &dummy, 1, NULL, NULL); + DWORD len; + rc = WriteFile(env->me_fd, &dummy, 1, &len, NULL); if (!rc) { rc = ErrCode(); return rc;