tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: O_DIRECTORY



On Sun, Sep 12, 2010 at 12:32:44AM +0200, Joerg Sonnenberger wrote:
> On Sat, Sep 11, 2010 at 02:01:43PM -0700, Chuck Silvers wrote:
> > the remaining missing bit that prevents acroread from working with the new
> > linux emulation code (PR 43695) is support for the O_DIRECTORY flag to 
> > open().
> > I was going to add this just in the linux emulation code but I noticed
> > that it's actually standardized in POSIX-2008 [1], and freebsd supports it
> > natively as well.  so now I'm thinking to add it to the native open() too.
> > there's a diff at:
> > 
> >     ftp://ftp.netbsd.org/pub/NetBSD/misc/chs/diff.linux-odir.1
> > 
> > 
> > any objections to adding this?
> 
> I like the flag. I would change the wording a bit to say "require the
> file to be a directory" (positive sense).

"require the file to be a directory" is awkward in a different way,
in that it doesn't really say what happens if the file is not a directory.

the effect of the flag is to cause the operation to fail under
certain conditions, so I think the wording I proposed is better.
the POSIX web page and the linux and freebsd manpages use
this style of wording as well.


> Thinking one step further -- would it make sense to have another flag to
> disallow devices? This would be useful for programs running with root
> privileges to avoid the stat race for opening path names with potential
> side effects.

I'll leave that for someone else to look at.

-Chuck


Home | Main Index | Thread Index | Old Index