summaryrefslogtreecommitdiffstats
path: root/winsup/cygwin/path.cc
diff options
context:
space:
mode:
Diffstat (limited to 'winsup/cygwin/path.cc')
-rw-r--r--winsup/cygwin/path.cc15
1 files changed, 15 insertions, 0 deletions
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;
}