summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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);