From afca59d426126402c4c9027634451359fba72390 Mon Sep 17 00:00:00 2001 From: Wenzel Jakob Date: Fri, 29 Nov 2013 18:52:42 +0100 Subject: [PATCH] mmap.cpp: be more relaxed about files already existing (and potentially being used by other Mitsuba instances) -- by Michael Zeilfelder --- src/libcore/mmap.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/libcore/mmap.cpp b/src/libcore/mmap.cpp index 6319403b..c2b5cd42 100644 --- a/src/libcore/mmap.cpp +++ b/src/libcore/mmap.cpp @@ -44,7 +44,7 @@ MemoryMappedFile::MemoryMappedFile(const fs::path &filename, size_t size) Log(EError, "close(): unable to close file!"); #elif defined(_WIN32) d->file = CreateFile(filename.string().c_str(), GENERIC_WRITE | GENERIC_READ, - FILE_SHARE_WRITE, NULL, CREATE_ALWAYS, + FILE_SHARE_WRITE|FILE_SHARE_READ, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); if (d->file == INVALID_HANDLE_VALUE) Log(EError, "Could not open \"%s\": %s", d->filename.string().c_str(), @@ -80,7 +80,7 @@ MemoryMappedFile::MemoryMappedFile(const fs::path &filename) Log(EError, "close(): unable to close file!"); #elif defined(WIN32) d->file = CreateFile(filename.string().c_str(), GENERIC_READ, - FILE_SHARE_READ, NULL, OPEN_EXISTING, + FILE_SHARE_WRITE|FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); if (d->file == INVALID_HANDLE_VALUE) Log(EError, "Could not open \"%s\": %s", d->filename.string().c_str(),