From b87cbe8486a2799a137c8100afaa05b352bb0ccf Mon Sep 17 00:00:00 2001 From: Sami Kerola Date: Wed, 4 Apr 2012 19:39:15 +0200 Subject: text-utils: verify writing to streams was successful Signed-off-by: Sami Kerola --- text-utils/col.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'text-utils/col.c') diff --git a/text-utils/col.c b/text-utils/col.c index baec1945a..dc9e9c8b2 100644 --- a/text-utils/col.c +++ b/text-utils/col.c @@ -56,6 +56,7 @@ #include "xalloc.h" #include "widechar.h" #include "strutils.h" +#include "closestream.h" #define BS '\b' /* backspace */ #define TAB '\t' /* tab */ @@ -174,6 +175,7 @@ int main(int argc, char **argv) setlocale(LC_ALL, ""); bindtextdomain(PACKAGE, LOCALEDIR); textdomain(PACKAGE); + atexit(close_stdout); max_bufd_lines = 128 * 2; compress_spaces = 1; /* compress spaces into tabs */ @@ -388,8 +390,6 @@ int main(int argc, char **argv) /* missing a \n on the last line? */ nblank_lines = 2; flush_blanks(); - if (ferror(stdout) || fclose(stdout)) - return EXIT_FAILURE; return ret; } -- cgit v1.2.3-55-g7522