summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJim Meyering <meyering@redhat.com>2009-08-21 19:19:39 +0200
committerJim Meyering <meyering@redhat.com>2009-08-24 18:15:13 +0200
commitb9a691af0fa468873eda3706a1c797568857785b (patch)
tree882e92e4da301f900b7231aa1be43c952b06b8db
parent8e6d1e1a31a69589fde10e3e230620f1e9d27866 (diff)
downloadlibguestfs-b9a691af0fa468873eda3706a1c797568857785b.tar.gz
libguestfs-b9a691af0fa468873eda3706a1c797568857785b.tar.xz
libguestfs-b9a691af0fa468873eda3706a1c797568857785b.zip
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.
-rwxr-xr-xbootstrap1
-rw-r--r--fish/fish.c3
2 files changed, 4 insertions, 0 deletions
diff --git a/bootstrap b/bootstrap
index 3fd8811e..f5f8aafc 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 156147a3..a7588106 100644
--- a/fish/fish.c
+++ b/fish/fish.c
@@ -40,6 +40,7 @@
#include <guestfs.h>
#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";