summaryrefslogtreecommitdiffstats
path: root/winsup/cygwin/mmap.cc
diff options
context:
space:
mode:
Diffstat (limited to 'winsup/cygwin/mmap.cc')
-rw-r--r--winsup/cygwin/mmap.cc9
1 files changed, 7 insertions, 2 deletions
diff --git a/winsup/cygwin/mmap.cc b/winsup/cygwin/mmap.cc
index 70cb36737..354bcaee6 100644
--- a/winsup/cygwin/mmap.cc
+++ b/winsup/cygwin/mmap.cc
@@ -1,6 +1,6 @@
/* mmap.cc
- Copyright 1996, 1997, 1998, 2000 Cygnus Solutions.
+ Copyright 1996, 1997, 1998, 2000, 2001 Cygnus Solutions.
This file is part of Cygwin.
@@ -689,7 +689,12 @@ fhandler_disk_file::mmap (caddr_t *addr, size_t len, DWORD access,
else
protect = PAGE_READONLY;
- HANDLE h = CreateFileMapping (get_handle(), &sec_none, protect, 0, len, NULL);
+ HANDLE h = CreateFileMapping (get_handle (),
+ &sec_none,
+ protect,
+ 0,
+ get_handle () == INVALID_HANDLE_VALUE ? len : 0,
+ NULL);
if (h == 0)
{
__seterrno ();