From patchwork Mon Jul 21 15:47:35 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chen Gang X-Patchwork-Id: 372144 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 670231400A8 for ; Tue, 22 Jul 2014 01:48:01 +1000 (EST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :message-id:date:from:mime-version:to:subject:content-type :content-transfer-encoding; q=dns; s=default; b=hqJn1W/NI9DAzxU/ /eBV3T3XGk6he6VSzcVi6sOqFdTaXOADExpoBnKKBuGfTa0EHubkhDjlvFxzpVYM L0HM7sr7eiqV5XOuyUMQs8ky9P3dDYIQGtB0OL6Sl1cyOYYiIy+P0BM6urjZAc5g yVL5os9RSz5oonzwfpRPnPrmo3c= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :message-id:date:from:mime-version:to:subject:content-type :content-transfer-encoding; s=default; bh=JBdXNx08LwFj9cfk/XCwrS ROq18=; b=WNMtSxAMkC6lXT6HdEqNXGvG4ZUhAEVGSZyF15bY3rlgDmuZfCRMnE x7nTgUoajySgrrSAeltdBf/v3r+liS6q5BnX9YNrf/fn4HWRhS9Wq37xAelhoXSV GXontWG2JGGOuaWJvtL4IdVTmBn1fReRru81kjoiadn9hUgC4L5y4= 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-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@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 23:47:35 +0800 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' '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); }