Is it considered to be ok to not check the return code of close(2) in base?

Poul-Henning Kamp phk at phk.freebsd.dk
Mon Jan 1 10:07:38 UTC 2018


--------
In message <5AD2D86A-2515-4D4D-91B2-1919531F7CC3 at dsl-only.net>, Mark Millard wr
ites:

>asserts that call abort are difficult to
>guarantee specific program-exit behavior
>for, based on just the standards anyway.

One should read "assert" in a source code as a curse along the lines of
"Strike me by lightning if this is not true!"

If you want more gentle behaviour you should implement proper errorhandling.

But for all the places where you think "Nahh ... that's never going to
happen", you should document your decision with assert().

-- 
Poul-Henning Kamp       | UNIX since Zilog Zeus 3.20
phk at FreeBSD.ORG         | TCP/IP since RFC 956
FreeBSD committer       | BSD since 4.3-tahoe    
Never attribute to malice what can adequately be explained by incompetence.


More information about the freebsd-hackers mailing list