Unix Programming - Re: POSIX Mistake: rewinddir returns no errors!

This is Interesting: Free IT Magazines  
Home > Archive > Unix Programming > February 2007 > Re: POSIX Mistake: rewinddir returns no errors!





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author Re: POSIX Mistake: rewinddir returns no errors!
Barry Margolin

2007-02-23, 1:22 am


Please don't multipost. I just responded to you in comp.unix.misc, and
now we have two different threads discussing the same thing.

In article <pan.2007.02.22.10.26.47.408285@web.de>,
unix_fan <tmellman@web.de> wrote:
> From
> http://www.opengroup.org/onlinepubs.../rewinddir.html
>
> DESCRIPTION
>
> The rewinddir() function shall reset the position of the directory
> stream to which dirp refers to the beginning of the directory. It
> shall also cause the directory stream to refer to the current state of
> the corresponding directory, as a call to opendir() would have done.
> If dirp does not refer to a directory stream, the effect is undefined.
>
>
>
>
>
> See quote above. In particular *It
> shall also cause the directory stream to refer to the current state of
> the corresponding directory, as a call to opendir() would have done*


All it has to do is throw away any buffered directory entries and reset
the directory pointer to the beginning. That ensures that it's working
with the current state, and doesn't require any I/O.

--
Barry Margolin, barmar@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***
*** PLEASE don't copy me on replies, I'll read them in the group ***
Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com