closedir(3) handling NULL

Garrett Wollman wollman at csail.mit.edu
Fri Jan 24 19:26:43 UTC 2014


<<On Sat, 25 Jan 2014 06:00:08 +1100 (EST), Bruce Evans <brde at optusnet.com.au> said:

> I don't know how the fd can be invalid for a (necessarily valid) stream.
> Maybe because the fd for a stdio stream is not private, and POSIX actually
> allows closing it directly.  At least this says "shall fail" instead of
> "may fail".  I think the "may fail" for closedir() is just buggy wording.
> The "may" is for the implementation not being required to use fd's at all.
> But when it uses them, errors from them should be "shall fail" like they
> are for fclose().

"may fail" has a very specific meaning in the "ERRORS" section: if the
implementation detects the condition described, it must use the
specified error number.

-GAWollman



More information about the freebsd-standards mailing list