Checking result of fprintf(stderr

John Gilmore gnu at hoptoad.uucp
Tue Aug 12 20:09:25 AEST 1986

In article <6017 at sun.uucp>, guy at sun.uucp (Guy Harris) writes:
> '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 at
		     May the Source be with you!

More information about the Comp.lang.c mailing list