delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2011/04/29/16:23:33

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=-1.3 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_NONE,T_RP_MATCHES_RCVD,UNPARSEABLE_RELAY
X-Spam-Check-By: sourceware.org
Message-ID: <4DBB1E2B.6090701@t-online.de>
Date: Fri, 29 Apr 2011 22:23:07 +0200
From: Christian Franke <Christian DOT Franke AT t-online DOT de>
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.17) Gecko/20110123 SeaMonkey/2.0.12
MIME-Version: 1.0
To: cygwin AT cygwin DOT com
Subject: Re: False positive from access("/proc/registry/...", F_OK)
References: <1QF1xL-1RJrwe0 AT fwd09 DOT aul DOT t-online DOT de> <20110427140851 DOT GU3324 AT calimero DOT vinschen DOT de>
In-Reply-To: <20110427140851.GU3324@calimero.vinschen.de>
X-IsSubscribed: yes
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

Corinna Vinschen wrote:
> On Apr 27 12:26, Christian Franke wrote:
>    
>> 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).
>>      
> I don't remember anymore why I did that and naturally I also didn't
> write a comment.
>    

:-)

I presume this fixed the access-denied-on-last-component case:

"/proc/registry/HKEY_LOCAL_MACHINE/SECURITY" -> filetype = 1 (OK)

but unfortunately then the same info is returned for all ".../SECURITY/*".


> But what you say sounds right to me.  Please create a patch.
>
>    

I'll try next week. A fix likely needs to enhance open_key() such that 
it returns info whether the access was denied on last component or not.

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

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019