* 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:.
This commit is contained in:
Corinna Vinschen
2005-03-10 17:02:52 +00:00
parent 542afc349c
commit 640c3ce5df
3 changed files with 25 additions and 1 deletions

View File

@@ -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;
}