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

Tobias Güntner fatbull at web.de
Fri Jun 15 16:43:38 CEST 2012

Am 15.06.2012 05:19, schrieb Rémi Denis-Courmont:
> Le vendredi 15 juin 2012 03:58:02 Tobias Güntner, vous avez écrit :
>> 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.

I agree that O_NONBLOCK suffers from this problem, but I fail to see its
relevance in this particular case.

Right now, the code in question only cares about directories and closes
everything else immediately [1]. With O_DIRECTORY, only directories
would be opened in the first place. And since (obviously ;)) FIFOs are
not directories, O_NONBLOCK would not be needed at all. Correct? :D



More information about the vlc-devel mailing list