ntdll: Use MAP_SHARED also for read-only mappings.

This essentially reverts commit dac252ecb4.
It's necessary for macOS.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Alexandre Julliard 2018-02-06 10:43:12 +01:00
parent ddfa042db1
commit b1f8a91e6c
1 changed files with 2 additions and 2 deletions

View File

@ -1146,7 +1146,7 @@ static NTSTATUS map_file_into_view( struct file_view *view, int fd, size_t start
{ {
void *ptr; void *ptr;
int prot = VIRTUAL_GetUnixProt( vprot | VPROT_COMMITTED /* make sure it is accessible */ ); int prot = VIRTUAL_GetUnixProt( vprot | VPROT_COMMITTED /* make sure it is accessible */ );
unsigned int flags = MAP_FIXED | ((vprot & VPROT_WRITE) ? MAP_SHARED : MAP_PRIVATE); unsigned int flags = MAP_FIXED | ((vprot & VPROT_WRITECOPY) ? MAP_PRIVATE : MAP_SHARED);
assert( start < view->size ); assert( start < view->size );
assert( start + size <= view->size ); assert( start + size <= view->size );
@ -1171,7 +1171,7 @@ static NTSTATUS map_file_into_view( struct file_view *view, int fd, size_t start
break; break;
case ENOEXEC: case ENOEXEC:
case ENODEV: /* filesystem doesn't support mmap(), fall back to read() */ case ENODEV: /* filesystem doesn't support mmap(), fall back to read() */
if (flags & MAP_SHARED) if (vprot & VPROT_WRITE)
{ {
ERR( "shared writable mmap not supported, broken filesystem?\n" ); ERR( "shared writable mmap not supported, broken filesystem?\n" );
return STATUS_NOT_SUPPORTED; return STATUS_NOT_SUPPORTED;