[net.lang.c] Checking result of fprintf

gnu@hoptoad.uucp (John Gilmore) (08/12/86)

In article <6017@sun.uucp>, guy@sun.uucp (Guy Harris) writes:
>           ...it's rarely useful to check for errors on an "fprintf" to
> "stderr" - if it fails, what can you do, print a message to "stderr"
> indicating you can't print a message to "stderr"?

I tend to disagree.  I often run large amounts of output e.g.
from "make" into a file, directing both stdout and stderr to the file.
Any program that doesn't stop when its writes to stderr fail will cause
the console to go nuts with "file system full" messages if your
disks are as full as mine.

If writing to stderr fails, I suggest that your program exit()
with some exit code (like the one it uses for other unexpected
system booboos, e.g. fork() or open("/") fails).

I agree with Henry that it sure would be nice if stdio would
call a user-defined function upon write errors.
-- 
John Gilmore  {sun,ptsfa,lll-crg,ihnp4}!hoptoad!gnu   jgilmore@lll-crg.arpa
		     May the Source be with you!