Is it considered to be ok to not check the return code of close(2) in base?
Rodney W. Grimes
freebsd-rwg at pdx.rh.CN85.dnsmgr.net
Mon Jan 8 16:55:26 UTC 2018
> 08.01.2018 23:13, Eric van Gyzen wrote:
>
> > Right, which is the reason such bugs are hard to diagnose. Optionally
> > killing the process on close->EBADF would help find buggy code when
> > another thread did NOT re-open the file descriptor between the two close
> > calls.
>
> Wouldn't "close(f); assert(errno != EBADF);" be better?
Or even
#ifdef DEBUG_CLOSE
#define close(f) close(f); assert(errno != EBADF);
#endif
Then the people that want to go chasing these errors can,
and the rest of us are untouched.
--
Rod Grimes rgrimes at freebsd.org
More information about the freebsd-hackers
mailing list