You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@apr.apache.org by "William A. Rowe, Jr." <wr...@rowe-clan.net> on 2001/01/20 03:15:44 UTC

APR_EXCL

Why do we insist on being apache?  Docs for APR_EXCL flag
state "Open should fail if APR_CREATE and file exists"

That's great for a web server.  Why in APR?

Bill

Re: APR_EXCL

Posted by rb...@covalent.net.
> > This is the win32 apr_open code...
> > 
> > if ((flag & APR_EXCL) && !(flag & APR_CREATE)) {
> >     return APR_EACCES;
> > }
> > 
> > That's not what I get out of the man pages.  What is the side
> > effect of O_EXCL and !O_CREATE?  I'm not clear.
> 
> O_EXCL is only useful when O_CREAT is used. Otherwise, O_EXCL can be
> ignored. (see _O_EXCL in your MSDN library)
> 
> The above test is probably redundant (read: remove it), since it shouldn't
> ever happen. (and our policy is to not worry about caller mistakes)

I disagree.  Try calling the unix code with APR_EXCL but not APR_CREATE,
it return APR_EACCESS.  Windows should do the same in this case.

Ryan

_______________________________________________________________________________
Ryan Bloom                        	rbb@apache.org
406 29th St.
San Francisco, CA 94131
-------------------------------------------------------------------------------


Re: APR_EXCL

Posted by Greg Stein <gs...@lyra.org>.
On Fri, Jan 19, 2001 at 08:47:28PM -0600, William A. Rowe, Jr. wrote:
> > From: Greg Stein [mailto:gstein@lyra.org]
> > Sent: Friday, January 19, 2001 8:38 PM
> > 
> > On Fri, Jan 19, 2001 at 08:15:44PM -0600, William A. Rowe, Jr. wrote:
> > > 
> > > Why do we insist on being apache?  Docs for APR_EXCL flag
> > > state "Open should fail if APR_CREATE and file exists"
> > > 
> > > That's great for a web server.  Why in APR?
> > 
> > Euh... what are you talking about? This is a standard flag. 
> > Look up O_EXCL in the open() man/doc pages.
> 
> This is the win32 apr_open code...
> 
> if ((flag & APR_EXCL) && !(flag & APR_CREATE)) {
>     return APR_EACCES;
> }
> 
> That's not what I get out of the man pages.  What is the side
> effect of O_EXCL and !O_CREATE?  I'm not clear.

O_EXCL is only useful when O_CREAT is used. Otherwise, O_EXCL can be
ignored. (see _O_EXCL in your MSDN library)

The above test is probably redundant (read: remove it), since it shouldn't
ever happen. (and our policy is to not worry about caller mistakes)

But APR_EXCL and APR_CREATE should remain.

Cheers,
-g

-- 
Greg Stein, http://www.lyra.org/

Re: APR_EXCL

Posted by Greg Stein <gs...@lyra.org>.
On Fri, Jan 19, 2001 at 08:15:44PM -0600, William A. Rowe, Jr. wrote:
> 
> Why do we insist on being apache?  Docs for APR_EXCL flag
> state "Open should fail if APR_CREATE and file exists"
> 
> That's great for a web server.  Why in APR?

Euh... what are you talking about? This is a standard flag. Look up O_EXCL
in the open() man/doc pages.

Cheers,
-g

-- 
Greg Stein, http://www.lyra.org/

Re: APR_EXCL

Posted by rb...@covalent.net.
> Why do we insist on being apache?  Docs for APR_EXCL flag
> state "Open should fail if APR_CREATE and file exists"
> 
> That's great for a web server.  Why in APR?

Because it's an incredibly useful thing to have.  This is just saying
create the file, but if it already exists, then return an error.  If you
just want to open the file, and don't care if it already exists, just
leave the APR_EXCL out.

Ryan

_______________________________________________________________________________
Ryan Bloom                        	rbb@apache.org
406 29th St.
San Francisco, CA 94131
-------------------------------------------------------------------------------