Hi Jorge, > Date: 2026-11-13 21:28:32+0000 > From: Jorge Almeida > > Hi, > > The opendir(3) manual page currently describes fdopendir() as being > "like opendir(), but returns a directory stream for the directory > referred to by the open file descriptor fd." > > However, it omits a critical detail documented in POSIX (fdopendir(3p)) > and the BSD man pages: fdopendir() uses the current file offset of fd > rather than resetting it to zero. > > If a caller duplicates an open directory descriptor with dup() and > exhausts the stream with readdir(), subsequent dup() + fdopendir() > calls will immediately hit EOF unless rewinddir() or lseek() is called. > By contrast, fdopen(3) explicitly warns that the stream's file > position indicator is set to that belonging to fd. > > Could a similar note be added to the fdopendir() description in > opendir(3)? Would you mind sending a patch? If so, you can have a look at and for some help (and I will gladly help if you have any questions). Have a lovely night! Alex > > Thanks. > --