[PATCH] Fix errno codes set by opendir() in case of problems with the path argument
Thu Mar 13 10:31:00 GMT 2014
On Mon, 3 Mar 2014 14:32:01 -0500, Christopher Faylor wrote:
> On Mon, Mar 03, 2014 at 10:34:59PM +0400, Oleg Kravtsov wrote:
>> Currently cygwin has a problem with errno code set by opendir()
>> function. It always sets errno to ENOENT.
>> After applying the path opendir() sets errno to 'ENAMETOOLONG' when path
>> or a path component is too long,
>> 'ELOOP' when a loop of symbolic links exits in the path.
>> 2014-02-18 Oleg Kravtsov <Oleg.Kravtsov@oktetlabs.ru>
>> * dir.cc (opendir): Set errno code depending on the type of an error
>> instead of always setting it to ENOENT.
> Thanks for the patch but I don't see any reason for a goto here. Also
> you seem to be skipping over a free which could result in a memory leak.
Actually I wanted opendir() to be in sync with other functions (mkdir, rmdir), i.e. use the same style.
There is no memory leak in the proposed patch, but it does not matter, your patch is also a valid one, though not comply the style used in other functions.
> I think the below should do the same thing without those limitations.
Yes, please fix it in a way you think is the most preferable.
> Does it work for you?
More information about the Cygwin-patches