[vlc-devel] [PATCH] access directory: try opening files as non blocking (fix #6940).

Rémi Denis-Courmont remi at remlab.net
Fri Jun 15 05:19:24 CEST 2012

Le vendredi 15 juin 2012 03:58:02 Tobias Güntner, vous avez écrit :
> Rémi Denis-Courmont:
> >> What if you use O_DIRECTORY instead of O_NONBLOCK?
> > 
> > That's Linux-specific. If we agree to ignore standards (which seems like
> > the only option), then we might as well use O_NONBLOCK, which is
> > probably more portable than O_DIRECTORY, and does not require further
> > code changes.
> Is this still the case? According to POSIX[1], O_NONBLOCK is unspecified
> for anything except FIFOs and special files, whereas O_DIRECTORY has no
> such limitation.

Fair enough. But I think there is still a TOCTOU problem if you use 
O_DIRECTORY. There is no way to tell open(at) *not* to open anything but a 
regular file or a FIFO if/when we use the O_NONBLOCK flag.

Rémi Denis-Courmont

More information about the vlc-devel mailing list