From 1d7432c0ef498a5b7e498500df1865fd9245a0a6 Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Fri, 18 Jul 2003 08:53:05 +0000 Subject: [PATCH] (main): Use close_stdout via atexit. Now `sort --version' and `sort --help' fail, as they should when their output is redirected to /dev/full. --- src/sort.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/sort.c b/src/sort.c index cb9b619b54..2d90724ee4 100644 --- a/src/sort.c +++ b/src/sort.c @@ -29,11 +29,12 @@ #include #include #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); -- 2.47.2