closedir(3) handling NULL

Garrett Wollman wollman at
Fri Jan 24 18:08:57 UTC 2014

<<On Fri, 24 Jan 2014 10:55:09 -0600, Bryan Drewery <bryan at> said:

> I'm not clear where you stand on this. Is EINVAL more proper or EBADF,
> or are you against the change all together?

If you pass a null pointer to a function that does not expect one, the
result is undefined.  If the process is not terminated, its state
(including errno and any register or memory contents) may be set to
any value whatsoever.

If it were me, and I for some reason wanted to check this corner case
explicitly, I'd use [EFAULT].


More information about the freebsd-standards mailing list