Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2005-03-10 20:02:52 +0300
committerCorinna Vinschen <corinna@vinschen.de>2005-03-10 20:02:52 +0300
commit640c3ce5df63845cb038e7008000eb51ec99a702 (patch)
treed78058b4648f7826f7e4906ea67b23344401baba
parent542afc349c83aadecde22dc7f561a8a0efcc5313 (diff)
* path.cc (is_floppy): New function.
(setmntent): Drop floppy drives on A: and B: from logical drive DWORD. * syscalls.cc (sync): Don't sync floppies on A: and B:.
-rw-r--r--winsup/cygwin/ChangeLog6
-rw-r--r--winsup/cygwin/path.cc15
-rw-r--r--winsup/cygwin/syscalls.cc5
3 files changed, 25 insertions, 1 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog
index b246f1279..c0ae04f9d 100644
--- a/winsup/cygwin/ChangeLog
+++ b/winsup/cygwin/ChangeLog
@@ -1,3 +1,9 @@
+2005-03-10 Corinna Vinschen <corinna@vinschen.de>
+
+ * path.cc (is_floppy): New function.
+ (setmntent): Drop floppy drives on A: and B: from logical drive DWORD.
+ * syscalls.cc (sync): Don't sync floppies on A: and B:.
+
2005-03-10 Christopher Faylor <cgf@timesys.com>
* autoload.cc (LoadDLLprime): Use nocopy segment or forked processes
diff --git a/winsup/cygwin/path.cc b/winsup/cygwin/path.cc
index 31f646e5b..151c8ea82 100644
--- a/winsup/cygwin/path.cc
+++ b/winsup/cygwin/path.cc
@@ -2472,11 +2472,26 @@ cygwin_umount (const char *path, unsigned flags)
return res;
}
+static bool
+is_floppy (const char *dos)
+{
+ char dev[256];
+ if (!QueryDosDevice (dos, dev, 256))
+ return false;
+ return strncasematch (dev, "\\Device\\Floppy", 14)
+ || strcasematch (dev, "A:");
+}
+
extern "C" FILE *
setmntent (const char *filep, const char *)
{
_my_tls.locals.iteration = 0;
_my_tls.locals.available_drives = GetLogicalDrives ();
+ /* Filter floppy drives on A: and B: */
+ if ((_my_tls.locals.available_drives & 1) && is_floppy ("A:"))
+ _my_tls.locals.available_drives &= ~1;
+ if ((_my_tls.locals.available_drives & 2) && is_floppy ("B:"))
+ _my_tls.locals.available_drives &= ~2;
return (FILE *) filep;
}
diff --git a/winsup/cygwin/syscalls.cc b/winsup/cygwin/syscalls.cc
index 180a2e808..b2375e650 100644
--- a/winsup/cygwin/syscalls.cc
+++ b/winsup/cygwin/syscalls.cc
@@ -964,11 +964,14 @@ sync ()
}
else if (wincap.is_winnt ()) /* 9x has no concept for opening volumes */
{
- DWORD drives = GetLogicalDrives ();
+ extern FILE *setmntent (const char *, const char *);
+ setmntent ("", "");
+ DWORD drives = _my_tls.locals.available_drives;
DWORD mask = 1;
strcpy (vol, "\\\\.\\A:");
do
{
+ /* Geeh. Try to sync only non-floppy drives. */
if (drives & mask)
{
debug_printf ("Try volume %s", vol);