9 comments

[ 3.0 ms ] story [ 31.0 ms ] thread
djb's old daemontools suite had an interesting solution to the "how to log failure when you can't write to a log" problem: a persistent child process with some space reserved in its argv, where it can stash some error messages which you can see with "ps" even when disks have failed.

http://cr.yp.to/daemontools/readproctitle.html

The "loosing the errno" issue seems to me easily avoidable: just save the current value if ferror returns an error.