From 174f1a392e5cf411710edaa212545e208270b24a Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Wed, 24 Jan 2001 04:00:41 +0000 Subject: [PATCH] * mmap.cc (fhandler_disk_file::mmap): Call CreateFileMapping with len != 0 only when performing an anonymous mapping. --- winsup/cygwin/ChangeLog | 5 +++++ winsup/cygwin/mmap.cc | 9 +++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index e663eccaa..6dfb911dd 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,8 @@ +Tue Jan 23 21:56:00 2001 Corinna Vinschen + + * mmap.cc (fhandler_disk_file::mmap): Call CreateFileMapping with + len != 0 only when performing an anonymous mapping. + Mon Jan 22 15:35:28 2001 Christopher Faylor * path.h: Add a new constant. 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 ();