Linus Torvalds [off-list ref] writes:
quoted
I was planning to push this out to 'master' this weekend.
I think that code is fine, but switching the order around could probably
make it less likely that stdio loses the errno for us.
So doing the last part in a different order, and making it say
/* Check for ENOSPC and EIO errors.. */
if (fflush(stdout))
die("write failure on standard output: %s", strerror(errno));
if (ferror(stdout))
die("unknown write failure on standard output");
if (fclose(stdout))
die("close failed on standard output: %s", strerror(errno));
return 0;
may recover at least non-transient errors.
That makes sense, to a certain degree, given that we do not
check every printf(). I'll forge your signature as usual ;-)
Thanks.