* mmap.cc (fhandler_disk_file::mmap): Call CreateFileMapping with

len != 0 only when performing an anonymous mapping.
This commit is contained in:
Corinna Vinschen 2001-01-24 04:00:41 +00:00
parent 1d8bdab0d5
commit 174f1a392e
2 changed files with 12 additions and 2 deletions

View File

@ -1,3 +1,8 @@
Tue Jan 23 21:56:00 2001 Corinna Vinschen <corinna@vinschen.de>
* 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 <cgf@cygnus.com> Mon Jan 22 15:35:28 2001 Christopher Faylor <cgf@cygnus.com>
* path.h: Add a new constant. * path.h: Add a new constant.

View File

@ -1,6 +1,6 @@
/* mmap.cc /* mmap.cc
Copyright 1996, 1997, 1998, 2000 Cygnus Solutions. Copyright 1996, 1997, 1998, 2000, 2001 Cygnus Solutions.
This file is part of Cygwin. This file is part of Cygwin.
@ -689,7 +689,12 @@ fhandler_disk_file::mmap (caddr_t *addr, size_t len, DWORD access,
else else
protect = PAGE_READONLY; 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) if (h == 0)
{ {
__seterrno (); __seterrno ();