This is the mail archive of the
libc-hacker@sourceware.cygnus.com
mailing list for the glibc project.
Re: several changes today
In dist.glibc, article <908688829.8619@noris.de>,
Roland McGrath <roland@frob.com> writes:
>
> 1003.1-1996 requires that opendir detect a nondirectory and return ENOTDIR.
> It is not optional. Unless the check is known for sure to be done by the
> kernel at the particular time, libc must check with fstat to be correct.
> As well as violating POSIX, allowing the possibility of failing to check
> would be a subtly incompatible change that might affect existing programs
> in obscure ways.
It's easy enough to find out if the flag is supported -- you do the fstat()
until you get the first ENOTDIR result from open(...|O_DIRECTORY).
If necessary, for it by calling opendir("/dev/null"). :-/