casts to (void)
Andy Fyfe
wjafyfe at watmath.UUCP
Wed Aug 7 07:41:25 AEST 1985
> The printf() function CAN FAIL and if you don't test for it,
> Murphy says that it WILL fail, under the worst possible
> circumstances (e.g., while updating YOUR pay record).
/usr/lib/news/expire uses fprintf to re-write the active file. It
didn't take the time to check the return value, and happened to run
one night when /usr was full. Result -- a 0 length active file and
a great deal of unhappy news software. printf (and fprintf) DO FAIL!
(Since someone asked, printf and fprintf return EOF if they fail.
(This is documented in our "UW Modified" man page). And don't forget
to check fclose, since output may not actually be written until the
file is closed. And don't let exit do the fclose's for you (since it
doesn't check for errors)!)
--Andy Fyfe ...!{decvax, allegra, ihnp4, et. al}!watmath!wjafyfe
wjafyfe at waterloo.csnet
More information about the Comp.lang.c
mailing list