Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 8 Jan 2018 08:55:24 -0800 (PST)
From:      "Rodney W. Grimes" <freebsd-rwg@pdx.rh.CN85.dnsmgr.net>
To:        Eugene Grosbein <eugen@grosbein.net>
Cc:        Eric van Gyzen <eric@vangyzen.net>, Brooks Davis <brooks@freebsd.org>, Alan Somers <asomers@freebsd.org>, Yuri <yuri@rawbw.com>, Ian Lepore <ian@freebsd.org>, Freebsd hackers list <freebsd-hackers@freebsd.org>
Subject:   Re: Is it considered to be ok to not check the return code of close(2) in base?
Message-ID:  <201801081655.w08GtO3D022568@pdx.rh.CN85.dnsmgr.net>
In-Reply-To: <5A5399AA.9020309@grosbein.net>

next in thread | previous in thread | raw e-mail | index | archive | help
> 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@freebsd.org



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201801081655.w08GtO3D022568>