On 06/20/12 09:27, Bruce Evans wrote: > On Wed, 20 Jun 2012, Eitan Adler wrote: >> Log: >> Don't close an uninitialized descriptor. [1] >> Add a sanity check for the validity of the passed fd. > > Library functions shouldn't use assert() or abort().
Why not? > The fd is not passed, but is a static variable under syslog()'s control. I understood "passed fd" to mean "fd we're passing to _close". >> closelog(void) >> { >> THREAD_LOCK(); >> - (void)_close(LogFile); >> - LogFile = -1; >> + assert(LogFile >= -1); > > Since this assert() can't fail (unless the CPU has a parity error or > or the memory behind Logfile has a parity error or another memory error > or was clobbered by a buffer overrun), this assert() doesn't break the > library but just wastes space. I asked eadler to include that on the basis that it made the code easier to understand. -- Colin Percival Security Officer Emeritus, FreeBSD | The power to serve Founder, Tarsnap | www.tarsnap.com | Online backups for the truly paranoid _______________________________________________ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"