[Patch] Avoid duplicate names in /proc/registry (which may crash find)

Christian Franke Christian.Franke@t-online.de
Sat Dec 13 13:38:00 GMT 2008


Corinna Vinschen wrote:
> On Dec 12 18:32, Christian Franke wrote:
>   
>> Why not encode "@" as a reserved name like it is already done for "." and 
>> ".." (which appear as "%2E" and "%2E.")? This would provide backward 
>> compatibility and consistency with current conversions:
>>
>> @ - default value
>> %40 - named key or value
>> %40%val - named value if key exists
>>
>> I will post a patch.
>>     
>
> Perfect.
>
>   

As a side effect, the patch fixes an old bug:
stat("/proc/registry/.../@", .) did not set st_size.


2008-12-13  Christian Franke  <franke@computer.org>

	* fhandler_registry.cc (DEFAULT_VALUE_NAME): Remove constant.
	(encode_regname): Encode empty (default) name to "@".
	Encode "@" to "%40".  Change error return to -1.
	(decode_regname): Decode "@" to empty name.  Decode "%40" to "@".
	(fhandler_registry::exists): Skip check for keys if name is empty.
	Remove check for DEFAULT_VALUE_NAME, now handled by decode_regname ().
	(fhandler_registry::readdir): Remove check for empty name, now
	handled by encode_regname ().
	(fhandler_registry::open): Remove check for DEFAULT_VALUE_NAME.
	(fhandler_registry::open_key): Fail with ENOENT if key name is empty.

Christian


-------------- next part --------------
A non-text attachment was scrubbed...
Name: cygwin-1.7-registry-defval.patch
Type: text/x-diff
Size: 5459 bytes
Desc: not available
URL: <http://cygwin.com/pipermail/cygwin-patches/attachments/20081213/081c6c60/attachment.bin>


More information about the Cygwin-patches mailing list