diff options
Diffstat (limited to 'winsup/cygwin/mmap.cc')
-rw-r--r-- | winsup/cygwin/mmap.cc | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/winsup/cygwin/mmap.cc b/winsup/cygwin/mmap.cc index e2eab3e..42a7b69 100644 --- a/winsup/cygwin/mmap.cc +++ b/winsup/cygwin/mmap.cc @@ -455,8 +455,9 @@ mmap (caddr_t addr, size_t len, int prot, int flags, int fd, off_t off) list *l = mmapped_areas->get_list_by_fd (fd); /* First check if this mapping matches into the chunk of another - already performed mapping. Only for MAP_SHARED mapping. */ - if (l && (flags & MAP_SHARED)) + already performed mapping. Only valid for MAP_SHARED and for + MAP_ANON in a special case of MAP_PRIVATE. */ + if (l && ((flags & MAP_SHARED) || (fd == -1 && off == 0))) { mmap_record *rec; if ((rec = l->match (off, len)) != NULL) |