* devices.in (dev_cygdrive_storage): Revert mapping to \Device\Null.

(dev_storage): Ditto for /dev.
	* devices.cc: Regenerate.
	* fhandler.cc (fhandler_base::open_null): New method to open a fake
	\Device\Null handler.
	(fhandler_base::open): Fix formatting.  Change O_ACCMODE test to a
	switch statement.  Simplify a test which still tested for a now unused
	create_disposition.
	* fhandler.h (fhandler_base::open_null): Declare.
	(fhandler_netdrive::close): Declare.
	* fhandler_dev.cc (fhandler_dev::open): Open fake \Device\Null handle
	by just calling new open_null method.
	* fhandler_disk_file.cc (fhandler_cygdrive::open): Ditto.
	* fhandler_netdrive.cc (fhandler_netdrive::open): Call open_null
	rather than setting nohandle.
	(fhandler_netdrive::close): New method.
	* fhandler_registry.cc (fetch_hkey): Fix token in RegOpenUserClassesRoot
	call.  Create valid key for HKEY_CURRENT_CONFIG by mapping to real key
	HKEY_LOCAL_MACHINE\System\CurrentControlSet\Hardware Profiles\Current.
	(fhandler_registry::open): Set nohandle only when using pseudo registry
	handle.
	* fhandler_virtual.cc (fhandler_virtual::opendir): Call open rather
	than just setting nohandle here.
	* fhandler_virtual::fstatvfs): Set ST_RDONLY fs flag.
	* globals.cc (ro_u_null): New readonly UNICODE_STRING for \Device\Null.
	* path.h (path_conv::set_path): Revert previous change caring for
	wide_path.
This commit is contained in:
Corinna Vinschen
2013-10-31 14:26:42 +00:00
parent a5f316d8cf
commit 5b312b4747
12 changed files with 138 additions and 79 deletions

View File

@ -1,7 +1,7 @@
/* fhandler_virtual.cc: base fhandler class for virtual filesystems
Copyright 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012
Red Hat, Inc.
Copyright 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012,
2013 Red Hat, Inc.
This file is part of Cygwin.
@ -84,10 +84,9 @@ fhandler_virtual::opendir (int fd)
else
{
cygheap_fdnew cfd;
if (cfd >= 0)
if (cfd >= 0 && open (O_RDONLY, 0))
{
cfd = this;
cfd->nohandle (true);
dir->__d_fd = cfd;
dir->__fh = this;
res = dir;
@ -273,6 +272,7 @@ fhandler_virtual::fstatvfs (struct statvfs *sfs)
set to something useful. Just as on Linux. */
memset (sfs, 0, sizeof (*sfs));
sfs->f_bsize = sfs->f_frsize = 4096;
sfs->f_flag = ST_RDONLY;
sfs->f_namemax = NAME_MAX;
return 0;
}