From: Jim Meyering Date: Fri, 21 Aug 2009 17:19:39 +0000 (+0200) Subject: guestfish: diagnose stdout write failure X-Git-Tag: 1.0.69~33 X-Git-Url: http://git.annexia.org/?p=libguestfs.git;a=commitdiff_plain;h=b9a691af0fa468873eda3706a1c797568857785b;hp=8e6d1e1a31a69589fde10e3e230620f1e9d27866 guestfish: diagnose stdout write failure Use gnulib's closeout module to ensure any failure to write to stdout is detected and reported. * fish/fish.c: Include "closeout.h". (main): Call atexit (close_stdout); * bootstrap (modules): Add closeout. --- diff --git a/bootstrap b/bootstrap index 3fd8811..f5f8aaf 100755 --- a/bootstrap +++ b/bootstrap @@ -50,6 +50,7 @@ gnulib_tool=$GNULIB_SRCDIR/gnulib-tool (cd daemon && mkdir -p tests lib && ../$gnulib_tool --update) modules=' +closeout gitlog-to-changelog gnu-make gnumakefile diff --git a/fish/fish.c b/fish/fish.c index 156147a..a758810 100644 --- a/fish/fish.c +++ b/fish/fish.c @@ -40,6 +40,7 @@ #include #include "fish.h" +#include "closeout.h" #include "progname.h" struct mp { @@ -140,6 +141,8 @@ main (int argc, char *argv[]) /* Set global program name that is not polluted with libtool artifacts. */ set_program_name (argv[0]); + atexit (close_stdout); + enum { HELP_OPTION = CHAR_MAX + 1 }; static const char *options = "a:Df:h::im:nrv?Vx";