Question to rewinddir() implementation in newlib/libc/posix
Jeff Johnston
jjohnstn@redhat.com
Tue Mar 9 20:38:00 GMT 2010
On 03/03/2010 09:13 AM, Sebastian Huber wrote:
> Hi,
>
> the function rewinddir() uses
>
> _seekdir((dirp), (off_t)0);
>
> The function _seekdir() is implemented in telldir.c. Here the offset is
> actually a hash table index. Since 0 is not a special case I doubt that the
> rewinddir() implementation is correct.
>
> CU
>
Hi Sebastian,
You are correct. The original code that this was based on had an
additional field in the DIR struct called rewinddir. This was set in
opendir.c add the end and that is why there is a comment about setting
the rewind location.
However, this field was not expected to be in platform's dirent.h so it
was never carried over.
I have modified the telldir code to start the index at 1 and to treat 0
as rewind. This should alleviate the problem and not require any
changes to sys/dirent.h.
-- Jeff J.
More information about the Newlib
mailing list