diff options
author | Sami Kerola | 2012-04-04 19:44:04 +0200 |
---|---|---|
committer | Sami Kerola | 2012-04-04 19:46:25 +0200 |
commit | cdd2a8c360c70d16804ace7cc923a6c6bb7c9ca9 (patch) | |
tree | 6e4b7254c8179edc8b8f3f1c0908f7e966732b49 /term-utils/setterm.c | |
parent | text-utils: verify writing to streams was successful (diff) | |
download | kernel-qcow2-util-linux-cdd2a8c360c70d16804ace7cc923a6c6bb7c9ca9.tar.gz kernel-qcow2-util-linux-cdd2a8c360c70d16804ace7cc923a6c6bb7c9ca9.tar.xz kernel-qcow2-util-linux-cdd2a8c360c70d16804ace7cc923a6c6bb7c9ca9.zip |
term-utils: verify writing to streams was successful
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Diffstat (limited to 'term-utils/setterm.c')
-rw-r--r-- | term-utils/setterm.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/term-utils/setterm.c b/term-utils/setterm.c index 64fe0eb6a..5a652931b 100644 --- a/term-utils/setterm.c +++ b/term-utils/setterm.c @@ -121,6 +121,7 @@ #include "c.h" #include "xalloc.h" #include "nls.h" +#include "closestream.h" #if __GNU_LIBRARY__ < 5 #ifndef __alpha__ @@ -1113,7 +1114,8 @@ perform_sequence(int vcterm) { err(EXIT_DUMPFILE, _("can not open dump file %s for output"), opt_sn_name); screendump(opt_sn_num, F); - fclose(F); + if (close_stream(F) != 0) + errx(EXIT_FAILURE, _("write error")); } /* -msg [on|off]. */ @@ -1225,6 +1227,7 @@ main(int argc, char **argv) { setlocale(LC_ALL, ""); bindtextdomain(PACKAGE, LOCALEDIR); textdomain(PACKAGE); + atexit(close_stdout); if (argc < 2) bad_arg = TRUE; |