This is the mail archive of the newlib@sourceware.org mailing list for the newlib project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Question to rewinddir() implementation in newlib/libc/posix


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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]