This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [patch, libgfortran] Fix PR59108 ACTION='READ' is using O_CREAT


On Fri, Nov 15, 2013 at 9:11 PM, Jerry DeLisle <jvdelisle@charter.net> wrote:
> The attached patch sets the create flag for the case where action is specified
> as read only.

I was looking at this yesterday, but didn't have time to finish
everything then. So I made a similar patch, which also takes into
account the case where ACTION= is not specified and opening the file
with read-write fails and we fall back to trying to open 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

FWIW, I see you haven't updated recently; since a week ago you should
also see O_CLOEXEC (unless you have some old system).

My alternate patch attached. Regtested on x86_64-unknown-linux-gnu, Ok
for trunk?

2013-11-15  Janne Blomqvist  <jb@gcc.gnu.org>

    PR fortran/59108
    * io/unix.c (regular_file): Don't set O_CREAT when opening a file
    read-only with unknown status. Mask out O_CREAT when falling back
    to opening read-only if ACTION= is not set and read-write fails.



-- 
Janne Blomqvist

Attachment: rdonly-creat.diff
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]