This is the mail archive of the
cygwin-patches
mailing list for the Cygwin project.
[PATCH] Fix access("/proc/registry/HKEY_PERFORMANCE_DATA", R_OK)
- From: Christian Franke <Christian dot Franke at t-online dot de>
- To: cygwin-patches at cygwin dot com
- Date: Thu, 05 May 2011 18:51:08 +0200
- Subject: [PATCH] Fix access("/proc/registry/HKEY_PERFORMANCE_DATA", R_OK)
This patch fixes access("/proc/registry/HKEY_PERFORMANCE_DATA", R_OK)
which always fails with EBADF.
Christian
2011-05-05 Christian Franke <franke@computer.org>
* security.cc (check_registry_access): Handle missing
security descriptor of HKEY_PERFORMANCE_DATA.
diff --git a/winsup/cygwin/security.cc b/winsup/cygwin/security.cc
index a52fc26..430a65f 100644
--- a/winsup/cygwin/security.cc
+++ b/winsup/cygwin/security.cc
@@ -1085,8 +1085,13 @@ check_registry_access (HANDLE hdl, int flags, bool effective)
desired |= KEY_SET_VALUE;
if (flags & X_OK)
desired |= KEY_QUERY_VALUE;
- if (!get_reg_sd (hdl, sd))
+
+ if ((HKEY) hdl == HKEY_PERFORMANCE_DATA)
+ /* RegGetKeySecurity() always fails with ERROR_INVALID_HANDLE. */
+ ret = 0;
+ else if (!get_reg_sd (hdl, sd))
ret = check_access (sd, reg_mapping, desired, flags, effective);
+
/* As long as we can't write the registry... */
if (flags & W_OK)
{