From 24f2bd8c9f62409ef7d7c919c9a53f438ee991cb Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Sat, 20 May 2000 22:06:38 +0000 Subject: Arrange to call close_stdout upon exit. Don't close stdout explicitly. --- src/paste.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/paste.c') diff --git a/src/paste.c b/src/paste.c index abd9be49d..781613715 100644 --- a/src/paste.c +++ b/src/paste.c @@ -41,6 +41,7 @@ #include #include #include "system.h" +#include "closeout.h" #include "error.h" /* The official name of this program (e.g., no `g' prefix). */ @@ -430,6 +431,8 @@ main (int argc, char **argv) bindtextdomain (PACKAGE, LOCALEDIR); textdomain (PACKAGE); + atexit (close_stdout); + have_read_stdin = 0; serial_merge = 0; delims = default_delims; @@ -474,7 +477,5 @@ main (int argc, char **argv) exit_status = paste_serial (argc - optind, &argv[optind]); if (have_read_stdin && fclose (stdin) == EOF) error (EXIT_FAILURE, errno, "-"); - if (ferror (stdout) || fclose (stdout) == EOF) - error (EXIT_FAILURE, errno, _("write error")); exit (exit_status == 0 ? EXIT_SUCCESS : EXIT_FAILURE); } -- cgit v1.2.3-54-g00ecf