False positive from access("/proc/registry/...", F_OK)
Christian Franke
Christian.Franke@t-online.de
Wed Apr 27 12:35:00 GMT 2011
access("/proc/registry/...", F_OK) returns 0 for all (including
nonexistent) entries below a registry key which cannot be opened:
Testcase (run with admin rights):
# cygcheck -f /bin/cygwin1.dll
cygwin-1.7.9-1
# cd /proc/registry/HKEY_LOCAL_MACHINE
# ls SECURITY
Cache Policy RXACT SAM
# cygdrop -- ls SECURITY
ls: reading directory SECURITY: Permission denied
# test -e SECURITY/NoSuchFile && echo yes
# cygdrop -- test -e SECURITY/NoSuchFile && echo yes
yes
Problem was likely introduced by fhandler_registry.cc change 1.52:
fhandler_registry::exists ()
...
if (!val_only)
hKey = open_key (path, KEY_READ, wow64, false);
- if (hKey != (HKEY) INVALID_HANDLE_VALUE)
+ if (hKey != (HKEY) INVALID_HANDLE_VALUE || get_errno () == EACCES)
file_type = 1;
else
open_key() returns INVALID_HANDLE_VALUE and EACCESS also if an upper
level key cannot be opened. The exists() function returns 1
(virt_directory) then, it should return 0 (virt_none).
Christian
--
Problem reports: http://cygwin.com/problems.html
FAQ: http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
More information about the Cygwin
mailing list