This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [gfortran] patch for PR 16196, error on OPEN(...STATUS='REPLACE')
- From: Richard Henderson <rth at redhat dot com>
- To: Bud Davis <bdavis at gcc dot gnu dot org>
- Cc: "gcc-patches at gcc dot gnu dot org" <gcc-patches at gcc dot gnu dot org>, gfortran <fortran at gcc dot gnu dot org>
- Date: Fri, 25 Jun 2004 18:14:49 -0700
- Subject: Re: [gfortran] patch for PR 16196, error on OPEN(...STATUS='REPLACE')
- References: <1088197352.4721.9.camel@localhost.localdomain>
On Fri, Jun 25, 2004 at 04:02:32PM -0500, Bud Davis wrote:
> ! if (stat (path, &statbuf) < 0)
> ! mode |= O_CREAT | O_EXCL;
> ! else
> ! mode |= O_TRUNC;
Why bother stat? Just add O_CREAT all the time.
There's no point to O_EXCL; you're just introducing a race condition.
r~