Calling mmap on a file stored on a volume with buggy file re-opening
currently bugchecks. This commit solves this by using the
init_reopen_attr helper function.

Signed-off-by: Les De Ridder <l...@lesderid.net>
---
 winsup/cygwin/mm/mmap.cc | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/winsup/cygwin/mm/mmap.cc b/winsup/cygwin/mm/mmap.cc
index 332c015a7..23bbc3a98 100644
--- a/winsup/cygwin/mm/mmap.cc
+++ b/winsup/cygwin/mm/mmap.cc
@@ -956,11 +956,10 @@ mmap (void *addr, size_t len, int prot, int flags, int 
fd, off_t off)
       HANDLE h;
       IO_STATUS_BLOCK io;
 
-      InitializeObjectAttributes (&attr, &ro_u_empty, 
fh->pc.objcaseinsensitive (),
-                                 fh->get_handle (), NULL);
       status = NtOpenFile (&h,
                           fh->get_access () | GENERIC_EXECUTE | SYNCHRONIZE,
-                          &attr, &io, FILE_SHARE_VALID_FLAGS,
+                          fh->pc.init_reopen_attr (attr, h), &io,
+                          FILE_SHARE_VALID_FLAGS,
                           FILE_SYNCHRONOUS_IO_NONALERT
                           | FILE_OPEN_FOR_BACKUP_INTENT);
       if (NT_SUCCESS (status))
-- 
2.41.0

Reply via email to