From caca482cde26129ae4ffa865ac8408ac06b1c9cf Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Mon, 11 Apr 2005 20:10:00 +0000 Subject: (main): Don't assume fopen returns stdout after closing stdout. Use freopen instead. --- src/ptx.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'src') 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++; } -- cgit v1.2.3-70-g09d2