summaryrefslogtreecommitdiff
path: root/src/comm.c
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>2000-05-20 22:04:16 +0000
committerJim Meyering <jim@meyering.net>2000-05-20 22:04:16 +0000
commitb2c7c6055d627e8c8bd1ede48b7c99272a850c54 (patch)
tree420cd7caaaa81f83ec6e5e40866bacd2ddad3e97 /src/comm.c
parentc75dc9689ef7a158da9b27e28ccd1b0e823e309d (diff)
downloadcoreutils-b2c7c6055d627e8c8bd1ede48b7c99272a850c54.tar.xz
Arrange to call close_stdout upon exit. Don't close stdout explicitly.
Diffstat (limited to 'src/comm.c')
-rw-r--r--src/comm.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/src/comm.c b/src/comm.c
index 502090285..eb5d1894c 100644
--- a/src/comm.c
+++ b/src/comm.c
@@ -1,5 +1,5 @@
/* comm -- compare two sorted files line by line.
- Copyright (C) 86, 90, 91, 1995-1999 Free Software Foundation, Inc.
+ Copyright (C) 86, 90, 91, 1995-2000 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -23,6 +23,7 @@
#include <getopt.h>
#include <sys/types.h>
#include "system.h"
+#include "closeout.h"
#include "linebuffer.h"
#include "error.h"
#include "hard-locale.h"
@@ -215,11 +216,6 @@ compare_files (char **infiles)
ret = 1;
}
}
- if (ferror (stdout) || fclose (stdout) == EOF)
- {
- error (0, errno, _("write error"));
- ret = 1;
- }
return ret;
}
@@ -233,6 +229,8 @@ main (int argc, char **argv)
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
+ atexit (close_stdout);
+
#ifdef ENABLE_NLS
hard_LC_COLLATE = hard_locale (LC_COLLATE);
#endif