summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2005-04-11 20:10:00 +0000
committerPaul Eggert <eggert@cs.ucla.edu>2005-04-11 20:10:00 +0000
commitcaca482cde26129ae4ffa865ac8408ac06b1c9cf (patch)
tree07b179256e117e19e228ecec60e6f40b05eebdf7 /src
parent02b75108661d6f9cdc953ec8a4641d761cb26c18 (diff)
downloadcoreutils-caca482cde26129ae4ffa865ac8408ac06b1c9cf.tar.xz
(main): Don't assume fopen returns stdout after closing
stdout. Use freopen instead.
Diffstat (limited to 'src')
-rw-r--r--src/ptx.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/src/ptx.c b/src/ptx.c
index 6e5d912be..a5f7c1aeb 100644
--- a/src/ptx.c
+++ b/src/ptx.c
@@ -2154,9 +2154,7 @@ Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.\n"),
if (optind < argc)
{
- /* FIXME: don't fclose here? */
- fclose (stdout);
- if (fopen (argv[optind], "w") == NULL)
+ if (! freopen (argv[optind], "w", stdout))
error (EXIT_FAILURE, errno, "%s", argv[optind]);
optind++;
}