summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>2003-07-18 08:53:05 +0000
committerJim Meyering <jim@meyering.net>2003-07-18 08:53:05 +0000
commit1d7432c0ef498a5b7e498500df1865fd9245a0a6 (patch)
tree95eb893dfef602fe7284ada30b7d32ed01439e32 /src
parentec5c04d7d8780c464a827df8ceb97beccacb7abf (diff)
downloadcoreutils-1d7432c0ef498a5b7e498500df1865fd9245a0a6.tar.xz
(main): Use close_stdout via atexit.
Now `sort --version' and `sort --help' fail, as they should when their output is redirected to /dev/full.
Diffstat (limited to 'src')
-rw-r--r--src/sort.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/sort.c b/src/sort.c
index cb9b619b5..2d90724ee 100644
--- a/src/sort.c
+++ b/src/sort.c
@@ -29,11 +29,12 @@
#include <stdio.h>
#include <assert.h>
#include "system.h"
-#include "long-options.h"
+#include "closeout.h"
#include "error.h"
#include "exitfail.h"
#include "hard-locale.h"
#include "inttostr.h"
+#include "long-options.h"
#include "physmem.h"
#include "posixver.h"
#include "stdio-safer.h"
@@ -2182,6 +2183,9 @@ main (int argc, char **argv)
atexit (cleanup);
+ atexit (close_stdout);
+ close_stdout_set_status (SORT_FAILURE);
+
hard_LC_COLLATE = hard_locale (LC_COLLATE);
#if HAVE_NL_LANGINFO
hard_LC_TIME = hard_locale (LC_TIME);