public inbox for cygwin-patches@cygwin.com
 help / color / mirror / Atom feed
From: Les De Ridder <les@lesderid.net>
To: cygwin-patches@cygwin.com
Cc: Les De Ridder <les@lesderid.net>
Subject: [PATCH 2/2] Use init_reopen_attr in mmap
Date: Mon,  7 Aug 2023 03:13:15 -0700	[thread overview]
Message-ID: <8ae84e831e6323f8d4e08b8c426b9a50dbd1cab4.1690932049.git.les@lesderid.net> (raw)
In-Reply-To: <cover.1690932049.git.les@lesderid.net>

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 <les@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


      parent reply	other threads:[~2023-08-07 10:13 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-07 10:13 [PATCH 0/2] Fix RAM disk crash Les De Ridder
2023-08-07 10:13 ` [PATCH 1/2] Detect RAM disks as a separate filesystem type Les De Ridder
2023-08-07 11:17   ` Corinna Vinschen
2023-08-07 10:13 ` Les De Ridder [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8ae84e831e6323f8d4e08b8c426b9a50dbd1cab4.1690932049.git.les@lesderid.net \
    --to=les@lesderid.net \
    --cc=cygwin-patches@cygwin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).