summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2020-04-24 16:22:26 +0200
committerCorinna Vinschen <corinna@vinschen.de>2020-04-24 16:22:26 +0200
commit39a1c3c96f0ac58f27a8db859228868342d05fed (patch)
tree56049a0dd7a6196170131793209aec3b73993856
parentb8349218955ffbb2b573a2de8efac61a800f4eb0 (diff)
downloadcygnal-39a1c3c96f0ac58f27a8db859228868342d05fed.tar.gz
cygnal-39a1c3c96f0ac58f27a8db859228868342d05fed.tar.bz2
cygnal-39a1c3c96f0ac58f27a8db859228868342d05fed.zip
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>
-rw-r--r--winsup/cygwin/fhandler_floppy.cc4
1 files 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))