From patchwork Fri Nov 15 19:11:34 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerry DeLisle X-Patchwork-Id: 291653 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)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 2B6762C00C3 for ; Sat, 16 Nov 2013 06:12:13 +1100 (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; q= dns; s=default; b=chEKkEbCCJ/Wh3qtuBbPgidpMnSZXXDP95fsixmlnBG6F8 ZsPIpv4kestrkQLuL+wmPft75tKQ2kxdsg4b/H8ZM+6iEoebh9nBe0iifoPG6x39 pZLMDVwRE4h2+x62woYsYxCwIoCBVViCc1yvcQIIr7pC3EVxDE+u/rxjuKhqk= 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; s= default; bh=d0grhOhvtlcDcyT61o1RcpwCntA=; b=OL/3F+eIJehK+DGpl55U hAAGw1BJudGZsa8iyk9Rax2t8r+get2NyfaBSuz5G5zwdqtActNKnoqgQ5EHrHV+ 4+Tl/EYLvgBq62vl5e7bTxlM4PI9j3PNaFqNWbBQhSk+jiUSoLEsnhaTNI/uEA+B q44/1Cg+bLsj7yZMN1x9mMI= Received: (qmail 31186 invoked by alias); 15 Nov 2013 19:11:50 -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 31166 invoked by uid 89); 15 Nov 2013 19:11:49 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=0.1 required=5.0 tests=AWL, BAYES_00, RDNS_NONE, SPF_PASS, URIBL_BLOCKED autolearn=no version=3.3.2 X-Spam-User: qpsmtpd, 2 recipients X-HELO: mta41.charter.net Received: from Unknown (HELO mta41.charter.net) (216.33.127.83) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 15 Nov 2013 19:11:47 +0000 Received: from imp11 ([10.20.200.11]) by mta41.charter.net (InterMail vM.8.01.05.02 201-2260-151-103-20110920) with ESMTP id <20131115191139.BOVM10143.mta41.charter.net@imp11>; Fri, 15 Nov 2013 14:11:39 -0500 Received: from pavilion.localdomain ([68.5.43.244]) by imp11 with smtp.charter.net id pvBe1m0045G55b005vBeQd; Fri, 15 Nov 2013 14:11:39 -0500 X-Authority-Analysis: v=2.0 cv=KYGKKnkD c=1 sm=1 a=mw+G4YjGptsaRR05zBLClw==:17 a=AizhB-pfR1kA:10 a=FgREtuvVP8cA:10 a=yUnIBFQkZM0A:10 a=hOpmn2quAAAA:8 a=U33unIasgnUA:10 a=mDV3o1hIAAAA:8 a=OMGGgERAUoWZLPuj9skA:9 a=wPNLvfGTeEIA:10 a=RrJHHUpICxZmlEGnnNEA:9 a=FnJ9Rc9V7q8A:10 a=LSW1mi3CKqAA:10 a=mw+G4YjGptsaRR05zBLClw==:117 X-Auth-id: anZkZWxpc2xlQGNoYXJ0ZXIubmV0 Message-ID: <528671E6.7010802@charter.net> Date: Fri, 15 Nov 2013 11:11:34 -0800 From: Jerry DeLisle User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.1.0 MIME-Version: 1.0 To: fortran@gcc.gnu.org, gcc patches Subject: [patch, libgfortran] Fix PR59108 ACTION='READ' is using O_CREAT The attached patch sets the create flag for the case where action is specified as read only. I have confirmed that the PR test case now only produces: open("wombat", O_RDONLY) = 3 open("numbat", O_RDONLY) = 4 open("dingbat", O_RDONLY) = 5 +++ exited with 0 +++ I can not think of a test case for this. Regression tested on x86-64 Linux. OK for trunk? Regards, Jerry 2013-11-15 Jerry DeLisle PR fortran/59108 * io/unix.c (regular_file): If the ACTION is read only set create flag to zero. Index: unix.c =================================================================== --- unix.c (revision 204848) +++ unix.c (working copy) @@ -1329,6 +1329,10 @@ regular_file (st_parameter_open *opp, unit_flags * break; case STATUS_UNKNOWN: + crflag = 0; + if (flags->action == ACTION_READ) + break; + /* Fall through. */ case STATUS_SCRATCH: crflag = O_CREAT; break;