From b9a691af0fa468873eda3706a1c797568857785b Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Fri, 21 Aug 2009 19:19:39 +0200 Subject: [PATCH] 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. --- bootstrap | 1 + fish/fish.c | 3 +++ 2 files changed, 4 insertions(+) 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"; -- 1.8.3.1