public inbox for cygwin-cvs@sourceware.org
help / color / mirror / Atom feed
From: Corinna Vinschen <corinna@sourceware.org>
To: cygwin-cvs@sourceware.org
Subject: [newlib-cygwin] Cygwin: raw disk I/O: lock floppys as well
Date: Fri, 24 Apr 2020 14:23:40 +0000 (GMT)	[thread overview]
Message-ID: <20200424142340.88B5638930F7@sourceware.org> (raw)

https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=39a1c3c96f0ac58f27a8db859228868342d05fed

commit 39a1c3c96f0ac58f27a8db859228868342d05fed
Author: Corinna Vinschen <corinna@vinschen.de>
Date:   Fri Apr 24 16:22:26 2020 +0200

    Cygwin: raw disk I/O: lock floppys as well
    
    The workaround to access the full disk required since Vista
    and described in http://support.microsoft.com/kb/942448
    (NOT ACCESSIBLE at the time of writing this commit message)
    is required on floppy drives as well.
    
    Signed-off-by: Corinna Vinschen <corinna@vinschen.de>

Diff:
---
 winsup/cygwin/fhandler_floppy.cc | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/winsup/cygwin/fhandler_floppy.cc b/winsup/cygwin/fhandler_floppy.cc
index 778d6ef98..2768a9cbf 100644
--- a/winsup/cygwin/fhandler_floppy.cc
+++ b/winsup/cygwin/fhandler_floppy.cc
@@ -161,7 +161,8 @@ fhandler_dev_floppy::lock_partition (DWORD to_write)
      If there's some file handle open on one of the affected partitions,
      this fails, but that's how it works...
      The high partition major numbers don't have a partition 0. */
-  if (get_major () >= DEV_SD_HIGHPART_START || get_minor () % 16 != 0)
+  if (get_major () == DEV_FLOPPY_MAJOR
+      || get_major () >= DEV_SD_HIGHPART_START || get_minor () % 16 != 0)
     {
       if (!DeviceIoControl (get_handle (), FSCTL_LOCK_VOLUME,
 			   NULL, 0, NULL, 0, &bytes_read, NULL))
@@ -302,7 +303,6 @@ fhandler_dev_floppy::write_file (const void *buf, DWORD to_write,
      See http://support.microsoft.com/kb/942448 for details.
      What we do here is to lock the affected partition(s) and retry. */
   if (*err == ERROR_ACCESS_DENIED
-      && get_major () != DEV_FLOPPY_MAJOR
       && get_major () != DEV_CDROM_MAJOR
       && (get_flags () & O_ACCMODE) != O_RDONLY
       && lock_partition (to_write))


                 reply	other threads:[~2020-04-24 14:23 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20200424142340.88B5638930F7@sourceware.org \
    --to=corinna@sourceware.org \
    --cc=cygwin-cvs@sourceware.org \
    /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).