mirror of
https://git.savannah.gnu.org/git/coreutils.git
synced 2026-11-19 03:33:43 +03:00
(main): Don't assume fopen returns stdout after closing
stdout. Use freopen instead.
This commit is contained in:
1 parent
02b7510866
commit
caca482cde
1 file changed
+1
-3
@@ -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++;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user