X-Recipient: archive-cygwin@delorie.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.Franke@t-online.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@cygwin.com
Subject: Re: False positive from access("/proc/registry/...", F_OK)
References: <1QF1xL-1RJrwe0@fwd09.aul.t-online.de> <20110427140851.GU3324@calimero.vinschen.de>
In-Reply-To: <20110427140851.GU3324@calimero.vinschen.de>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-IsSubscribed: yes
Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe@cygwin.com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-help@cygwin.com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
Delivered-To: mailing list cygwin@cygwin.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

