(main): Don't assume fopen returns stdout after closing

stdout.  Use freopen instead.
This commit is contained in:
Paul Eggert committed 2005-04-11 20:10:00 +00:00
1 parent 02b7510866
commit caca482cde
1 file changed
+1 -3
+1 -3
View File
@@ -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++;
}