From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3600 invoked by alias); 21 Jul 2014 15:47:54 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 3588 invoked by uid 89); 21 Jul 2014 15:47:53 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.0 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-pd0-f176.google.com Received: from mail-pd0-f176.google.com (HELO mail-pd0-f176.google.com) (209.85.192.176) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Mon, 21 Jul 2014 15:47:52 +0000 Received: by mail-pd0-f176.google.com with SMTP id y10so9291143pdj.35 for ; Mon, 21 Jul 2014 08:47:43 -0700 (PDT) X-Received: by 10.68.186.33 with SMTP id fh1mr4562559pbc.140.1405957663109; Mon, 21 Jul 2014 08:47:43 -0700 (PDT) Received: from [192.168.1.104] ([223.72.65.26]) by mx.google.com with ESMTPSA id br1sm14578729pbc.6.2014.07.21.08.47.41 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Mon, 21 Jul 2014 08:47:42 -0700 (PDT) Message-ID: <53CD3617.2000503@gmail.com> Date: Mon, 21 Jul 2014 16:38:00 -0000 From: Chen Gang User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130625 Thunderbird/17.0.7 MIME-Version: 1.0 To: "Joseph S. Myers" , rth@redhat.com, gcc-patches@gcc.gnu.org Subject: [PATCH] gcc/toplev.c: Avoid to close 'asm_out_file' when it is 'stdout' Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-SW-Source: 2014-07/txt/msg01402.txt.bz2 '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 --- 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