summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2014-05-20 10:25:32 +0000
committerCorinna Vinschen <corinna@vinschen.de>2014-05-20 10:25:32 +0000
commit3da259f729948e75aacd972ac2200499b2311117 (patch)
tree25a8c2d8f84e353c5b0583e2479044a789bea2d2
parent51a895f86d7185185d60be507494c03dd3c4342a (diff)
downloadcygnal-3da259f729948e75aacd972ac2200499b2311117.tar.gz
cygnal-3da259f729948e75aacd972ac2200499b2311117.tar.bz2
cygnal-3da259f729948e75aacd972ac2200499b2311117.zip
* fhandler_floppy.cc (fhandler_dev_floppy::get_drive_info): Fix floppy
drive handling broken with 1.7.19.
-rw-r--r--winsup/cygwin/ChangeLog5
-rw-r--r--winsup/cygwin/fhandler_floppy.cc30
-rw-r--r--winsup/cygwin/release/1.7.303
3 files changed, 30 insertions, 8 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog
index 3e84f4e2e..5670bec98 100644
--- a/winsup/cygwin/ChangeLog
+++ b/winsup/cygwin/ChangeLog
@@ -1,5 +1,10 @@
2014-05-20 Corinna Vinschen <corinna@vinschen.de>
+ * fhandler_floppy.cc (fhandler_dev_floppy::get_drive_info): Fix floppy
+ drive handling broken with 1.7.19.
+
+2014-05-20 Corinna Vinschen <corinna@vinschen.de>
+
* scandir.cc (scandir): Assume namelist is always valid, per POSIX.
(CID 60021).
* sec_auth.cc (cygwin_logon_user): Securely erase password copy.
diff --git a/winsup/cygwin/fhandler_floppy.cc b/winsup/cygwin/fhandler_floppy.cc
index 9e4b1ce1d..8cf19bf82 100644
--- a/winsup/cygwin/fhandler_floppy.cc
+++ b/winsup/cygwin/fhandler_floppy.cc
@@ -2,7 +2,7 @@
fhandler classes.
Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009,
- 2011, 2012, 2013 Red Hat, Inc.
+ 2011, 2012, 2013, 2014 Red Hat, Inc.
This file is part of Cygwin.
@@ -63,12 +63,6 @@ fhandler_dev_floppy::get_drive_info (struct hd_geometry *geo)
{
dix = (DISK_GEOMETRY_EX *) dbuf;
di = &dix->Geometry;
- if (!DeviceIoControl (get_handle (),
- IOCTL_DISK_GET_PARTITION_INFO_EX, NULL, 0,
- pbuf, 256, &bytes_read, NULL))
- __seterrno ();
- else
- pix = (PARTITION_INFORMATION_EX *) pbuf;
}
}
if (!di)
@@ -81,6 +75,23 @@ fhandler_dev_floppy::get_drive_info (struct hd_geometry *geo)
return -1;
}
di = (DISK_GEOMETRY *) dbuf;
+ }
+ if (dix) /* Don't try IOCTL_DISK_GET_PARTITION_INFO_EX if
+ IOCTL_DISK_GET_DRIVE_GEOMETRY_EX didn't work.
+ Probably a floppy.*/
+ {
+ if (!DeviceIoControl (get_handle (),
+ IOCTL_DISK_GET_PARTITION_INFO_EX, NULL, 0,
+ pbuf, 256, &bytes_read, NULL))
+ __seterrno ();
+ else
+ pix = (PARTITION_INFORMATION_EX *) pbuf;
+ }
+ if (!pix && get_major () != DEV_FLOPPY_MAJOR)
+ {
+ /* It's unlikely that this code path will be used at all. Either the
+ _EX call already worked, or it's a floppy. But it doesn't hurt to
+ keep the code in. */
if (!DeviceIoControl (get_handle (),
IOCTL_DISK_GET_PARTITION_INFO, NULL, 0,
pbuf, 256, &bytes_read, NULL))
@@ -101,13 +112,16 @@ fhandler_dev_floppy::get_drive_info (struct hd_geometry *geo)
pix->PartitionLength.QuadPart);
drive_size = pix->PartitionLength.QuadPart;
}
- else
+ else if (pi)
{
debug_printf ("partition info: offset %D length %D",
pi->StartingOffset.QuadPart,
pi->PartitionLength.QuadPart);
drive_size = pi->PartitionLength.QuadPart;
}
+ else /* Floppy drive. */
+ drive_size = di->Cylinders.QuadPart * di->TracksPerCylinder
+ * di->SectorsPerTrack * di->BytesPerSector;
if (geo)
{
geo->heads = di->TracksPerCylinder;
diff --git a/winsup/cygwin/release/1.7.30 b/winsup/cygwin/release/1.7.30
index 521ca17e3..f0cc46dff 100644
--- a/winsup/cygwin/release/1.7.30
+++ b/winsup/cygwin/release/1.7.30
@@ -36,3 +36,6 @@ Bug Fixes
- Ignore trailing whitespace on #! scripts.
Addresses: https://cygwin.com/ml/cygwin/2014-05/msg00022.html
+
+- Fix raw floppy drive handling broken since 1.7.19.
+ Addresses: https://cygwin.com/ml/cygwin/2014-05/msg00401.html