* fhandler_registry.cc (fhandler_registry::exists): Fix regression

in EACCES handling.
	(fhandler_registry::open): Fix "%val" case.
This commit is contained in:
Corinna Vinschen 2011-05-05 06:45:21 +00:00
parent 5069a2b0d9
commit 2849cbde54
2 changed files with 10 additions and 2 deletions

View File

@ -1,3 +1,9 @@
2011-05-04 Christian Franke <franke@computer.org>
* fhandler_registry.cc (fhandler_registry::exists): Fix regression
in EACCES handling.
(fhandler_registry::open): Fix "%val" case.
2011-05-04 Christopher Faylor <me.cygwin2011@cgf.cx> 2011-05-04 Christopher Faylor <me.cygwin2011@cgf.cx>
* signal.cc (_pinfo::kill): Return success on kill(0) only if pid * signal.cc (_pinfo::kill): Return success on kill(0) only if pid

View File

@ -317,10 +317,12 @@ fhandler_registry::exists ()
if (!val_only) if (!val_only)
hKey = open_key (path, KEY_READ, wow64, false); hKey = open_key (path, KEY_READ, wow64, false);
if (hKey != (HKEY) INVALID_HANDLE_VALUE || get_errno () == EACCES) if (hKey != (HKEY) INVALID_HANDLE_VALUE)
file_type = virt_directory; file_type = virt_directory;
else else
{ {
/* Key does not exist or open failed with EACCES,
enumerate subkey and value names of parent key. */
hKey = open_key (path, KEY_READ, wow64, true); hKey = open_key (path, KEY_READ, wow64, true);
if (hKey == (HKEY) INVALID_HANDLE_VALUE) if (hKey == (HKEY) INVALID_HANDLE_VALUE)
return virt_none; return virt_none;
@ -797,7 +799,7 @@ fhandler_registry::open (int flags, mode_t mode)
handle = open_key (path, KEY_READ, wow64, false); handle = open_key (path, KEY_READ, wow64, false);
if (handle == (HKEY) INVALID_HANDLE_VALUE) if (handle == (HKEY) INVALID_HANDLE_VALUE)
{ {
if (get_errno () != EACCES) if (val_only || get_errno () != EACCES)
handle = open_key (path, KEY_READ, wow64, true); handle = open_key (path, KEY_READ, wow64, true);
if (handle == (HKEY) INVALID_HANDLE_VALUE) if (handle == (HKEY) INVALID_HANDLE_VALUE)
{ {