From: Jim Meyering Date: Fri, 18 Jul 2003 08:53:05 +0000 (+0000) Subject: (main): Use close_stdout via atexit. X-Git-Tag: v5.0.90~209 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1d7432c0ef498a5b7e498500df1865fd9245a0a6;p=thirdparty%2Fcoreutils.git (main): Use close_stdout via atexit. Now `sort --version' and `sort --help' fail, as they should when their output is redirected to /dev/full. --- 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);