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,
/* 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;