[Patch] Avoid duplicate names in /proc/registry (which may crash find)
Christian Franke
Christian.Franke@t-online.de
Sun Dec 7 19:04:00 GMT 2008
Hi Corinna,
Corinna Vinschen wrote:
> ...
>> With the attached patch, a duplicate name "foo" is handled as follows:
>>
>> - readdir() returns the key as "foo" and the value as "foo%val".
>> - If the name is "foo%val", stat() and open() consider only the value
>> "foo".
>>
>> This keeps the names 'as is' if possible and allows access to the (very
>> few) entries with duplicate names. The "%val" is at least somewhat
>> self-explanatory.
>>
>
> Cool. Can you please send a ChangeLog entry as well?
>
>
Of course:
2008-12-07 Christian Franke <franke@computer.org>
* fhandler_registry.cc (encode_regname): Add Parameter add_val.
Append "%val" if add_val is set.
(decode_regname): Remove trailing "%val". Change returncode
accordingly.
(__DIR_hash): New class.
(d_hash): New macro.
(key_exists): New function.
(fhandler_registry::exists): Remove encode of registry name
before path compare, decode file part of path instead.
Skip checks for keys if trailing "%val" detected.
(fhandler_registry::fstat): Change check of return
value of decode_regname ().
(fhandler_registry::readdir): Allocate __DIR_hash.
Record key names in hash table. Append "%val" if key with
same name exists. Fix error handling of encode_regname ().
Set dirent.d_type.
(fhandler_registry::closedir): Delete __DIR_hash.
(fhandler_registry::open): Don't open key if trailing "%val"
detected by decode_regname ().
(open_key): Ditto.
Christian
More information about the Cygwin-patches
mailing list