summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>2005-04-09 16:29:29 +0000
committerJim Meyering <jim@meyering.net>2005-04-09 16:29:29 +0000
commit493aba2ae5bb9b3c4281c693ee6fe88526fe5b82 (patch)
tree1a706808a9bf7d0b1999ed0ecafb38013bc57bb5 /src
parentc06188c05c03bd518ca2d6ae77fdc25cb8d16195 (diff)
downloadcoreutils-493aba2ae5bb9b3c4281c693ee6fe88526fe5b82.tar.xz
(close_stdout_wrapper): Likewise.
Don't close STDOUT_FILENO explicitly; close_stdout does it.
Diffstat (limited to 'src')
-rw-r--r--src/cat.c19
1 files changed, 1 insertions, 18 deletions
diff --git a/src/cat.c b/src/cat.c
index 99064cabe..2d98e1099 100644
--- a/src/cat.c
+++ b/src/cat.c
@@ -488,17 +488,6 @@ cat (
}
}
-/* This is gross, but necessary, because of the way close_stdout
- works and because this program closes STDOUT_FILENO directly. */
-static void (*closeout_func) (void) = close_stdout;
-
-static void
-close_stdout_wrapper (void)
-{
- if (closeout_func)
- (*closeout_func) ();
-}
-
int
main (int argc, char **argv)
{
@@ -574,7 +563,7 @@ main (int argc, char **argv)
/* Arrange to close stdout if we exit via the
case_GETOPT_HELP_CHAR or case_GETOPT_VERSION_CHAR code. */
- atexit (close_stdout_wrapper);
+ atexit (close_stdout);
/* Parse command line options. */
@@ -648,9 +637,6 @@ main (int argc, char **argv)
}
}
- /* Don't close stdout on exit from here on. */
- closeout_func = NULL;
-
/* Get device, i-node number, and optimal blocksize of output. */
if (fstat (STDOUT_FILENO, &stat_buf) < 0)
@@ -852,8 +838,5 @@ main (int argc, char **argv)
if (have_read_stdin && close (STDIN_FILENO) < 0)
error (EXIT_FAILURE, errno, _("closing standard input"));
- if (close (STDOUT_FILENO) < 0)
- error (EXIT_FAILURE, errno, _("closing standard output"));
-
exit (ok ? EXIT_SUCCESS : EXIT_FAILURE);
}