All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alejandro Colomar <alx+linux-man@kernel.org>
To: Jorge Almeida <jjalmeida@gmail.com>
Cc: linux-man@vger.kernel.org
Subject: Re: [bug report] opendir(3): document file offset behavior for fdopendir()
Date: Fri, 13 Nov 2026 22:39:02 +0100	[thread overview]
Message-ID: <aveC_KnRVLx8eCkt@devuan> (raw)
In-Reply-To: <CAKpSnp+XojktUF=UL81JZ2bFyBSxXHneFSBsiPi2BMg043xa3g@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1311 bytes --]


Hi Jorge,

> Date: 2026-11-13 21:28:32+0000
> From: Jorge Almeida <jjalmeida@gmail.com>
>
> 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
<https://git.kernel.org/pub/scm/docs/man-pages/man-pages.git/tree/CONTRIBUTING>
and
<https://git.kernel.org/pub/scm/docs/man-pages/man-pages.git/tree/CONTRIBUTING.d/>
for some help (and I will gladly help if you have any questions).


Have a lovely night!
Alex

> 
> Thanks.
> 

-- 
<https://www.alejandro-colomar.es>

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

      reply	other threads:[~2026-11-13 21:39 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-13 21:28 [bug report] opendir(3): document file offset behavior for fdopendir() Jorge Almeida
2026-11-13 21:39 ` Alejandro Colomar [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=aveC_KnRVLx8eCkt@devuan \
    --to=alx+linux-man@kernel.org \
    --cc=jjalmeida@gmail.com \
    --cc=linux-man@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.