public inbox for libc-help@sourceware.org
 help / color / mirror / Atom feed
From: flint pyrite <flintnpyrite@gmail.com>
To: libc-help@sourceware.org
Subject: readdir and ENOENT error or EOF?
Date: Wed, 16 Jun 2021 20:38:42 -0600	[thread overview]
Message-ID: <CAPdH1feeZWYTOEgz=Q14PnfccHqz=gE6qwr9-L0bfK7rh2xDQg@mail.gmail.com> (raw)

There appears to be ambiguity in user documentation for readdir when
it returns NULL and errno is set to ENOENT.

Is this an EOF condition or an actual error that should be handled?

...
/* On some systems getdents fails with ENOENT when the
open directory has been rmdir'd already. POSIX.1
requires that we treat this condition like normal EOF. */
if (bytes < 0 && errno == ENOENT)
bytes = 0;
...
https://code.woboq.org/userspace/glibc/sysdeps/posix/readdir.c.htmlin

Thanks in advance for your time and help on this matter.

             reply	other threads:[~2021-06-17  2:39 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-17  2:38 flint pyrite [this message]
2021-06-17  2:59 ` flint pyrite

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='CAPdH1feeZWYTOEgz=Q14PnfccHqz=gE6qwr9-L0bfK7rh2xDQg@mail.gmail.com' \
    --to=flintnpyrite@gmail.com \
    --cc=libc-help@sourceware.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).