public inbox for libc-help@sourceware.org
 help / color / mirror / Atom feed
* readdir and ENOENT error or EOF?
@ 2021-06-17  2:38 flint pyrite
  2021-06-17  2:59 ` flint pyrite
  0 siblings, 1 reply; 2+ messages in thread
From: flint pyrite @ 2021-06-17  2:38 UTC (permalink / raw)
  To: libc-help

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.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-06-17  2:59 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-17  2:38 readdir and ENOENT error or EOF? flint pyrite
2021-06-17  2:59 ` flint pyrite

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).