Hacker News new | ask | show | jobs
by mcbrit 1565 days ago
This is explicitly called out and handled in lines 151-155.

https://git.savannah.gnu.org/cgit/hello.git/tree/src/hello.c

Here's the comment:

  /* Even exiting has subtleties.  On exit, if any writes failed, change
     the exit status.  The /dev/full device on GNU/Linux can be used for
     testing; for instance, hello >/dev/full should exit unsuccessfully.
     This is implemented in the Gnulib module "closeout".  */
2 comments

Jim Meyering's discussion on how this is handled usually in GNU programs

https://www.gnu.org/ghm/2011/paris/slides/jim-meyering-goodb...

Thank you.