Bug in readdir_r errno handling

Jeff Johnston jjohnstn@redhat.com
Fri Mar 2 02:47:00 GMT 2012

On 03/01/2012 04:44 PM, David Benjamin wrote:
> readdir_r in newlib/libc/posix/readdir_r.c returns errno if getdents
> fails or reaches the end of the directory (a return of 0). But
> getdents only sets errno on negative returns. If a previous library
> call had failed and set errno, it would keep this value and readdir_r
> returns an error instead of 0 on EOF.
> David Benjamin

You are correct.  I'll make up a patch.

-- Jeff J.

More information about the Newlib mailing list