public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] gcc/toplev.c: Avoid to close 'asm_out_file' when it is 'stdout'
@ 2014-07-21 16:38 Chen Gang
  2014-07-23 13:47 ` Jeff Law
  0 siblings, 1 reply; 5+ messages in thread
From: Chen Gang @ 2014-07-21 16:38 UTC (permalink / raw)
  To: Joseph S. Myers, rth, gcc-patches

'asm_out_file' may be 'stdout', so need check this case before close it.
Or 'stdout' may be closed -- since need not open 'stdout', either need
not close it.

ChangLog:

  * topleve.c (finalize): Avoid to close 'asm_out_file' when it is
  'stdout'.

Signed-off-by: Chen Gang <gang.chen.5i5j@gmail.com>
---
 gcc/toplev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gcc/toplev.c b/gcc/toplev.c
index 1c9befd..5fc11ae 100644
--- a/gcc/toplev.c
+++ b/gcc/toplev.c
@@ -1878,7 +1878,7 @@ finalize (bool no_backend)
     {
       if (ferror (asm_out_file) != 0)
 	fatal_error ("error writing to %s: %m", asm_file_name);
-      if (fclose (asm_out_file) != 0)
+      if (asm_out_file != stdout && fclose (asm_out_file) != 0)
 	fatal_error ("error closing %s: %m", asm_file_name);
     }
 
-- 
1.7.11.7

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2014-07-26  1:33 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-07-21 16:38 [PATCH] gcc/toplev.c: Avoid to close 'asm_out_file' when it is 'stdout' Chen Gang
2014-07-23 13:47 ` Jeff Law
2014-07-23 22:20   ` Chen Gang
2014-07-25 21:16     ` Jeff Law
2014-07-26  3:26       ` Chen Gang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).