* 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

@ -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> 2005-03-10 Christopher Faylor <cgf@timesys.com>
* autoload.cc (LoadDLLprime): Use nocopy segment or forked processes * autoload.cc (LoadDLLprime): Use nocopy segment or forked processes

View File

@ -2472,11 +2472,26 @@ cygwin_umount (const char *path, unsigned flags)
return res; 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 * extern "C" FILE *
setmntent (const char *filep, const char *) setmntent (const char *filep, const char *)
{ {
_my_tls.locals.iteration = 0; _my_tls.locals.iteration = 0;
_my_tls.locals.available_drives = GetLogicalDrives (); _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; return (FILE *) filep;
} }

View File

@ -964,11 +964,14 @@ sync ()
} }
else if (wincap.is_winnt ()) /* 9x has no concept for opening volumes */ 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; DWORD mask = 1;
strcpy (vol, "\\\\.\\A:"); strcpy (vol, "\\\\.\\A:");
do do
{ {
/* Geeh. Try to sync only non-floppy drives. */
if (drives & mask) if (drives & mask)
{ {
debug_printf ("Try volume %s", vol); debug_printf ("Try volume %s", vol);