This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH, libgfortran] Fix for PR 18982
On Thu, Jan 13, 2005 at 05:47:38PM -0800, Richard Henderson wrote:
> On Fri, Jan 14, 2005 at 01:14:36AM +0100, Andreas Schwab wrote:
> > +#ifndef O_ACCMODE
> > +#define O_ACCMODE 3
> > +#endif
>
> Nor does this make sense. You'd have to use (O_RDWR|O_RDONLY|O_WRONLY).
The Linux man page for open() states that only one of O_RDWR,
O_RDONLY or O_WRONLY can be used at a time.
I think the right thing to do for unspecified access would be to
try O_RDWR first, then check the errno. If this fails with
EACCESS, try O_RDONLY next. If that fails with EACCESS, try
O_WRONLY.
Thomas