[FFmpeg-devel] [RFC] libavformat/avio.h API cleanup

Måns Rullgård mans
Sun Mar 6 18:31:55 CET 2011


Nicolas George <nicolas.george at normalesup.org> writes:

> Le sextidi 16 vent?se, an CCXIX, Stefano Sabatini a ?crit?:
>> > URL_RDONLY
>> > URL_WRONLY
>> > URL_RDWR
>> > URL_FLAG_NONBLOCK
>> Maybe we should add FLAG to the other constants.
>
> RDONLY / WRONLY / RDWR are not really flags: flags are usually supposed to
> be booleans, they are there or not.
>
> I think this is an historical misfeature of Unix to have these three modes
> and not FLAG_READ and FLAG_WRITE, with READ_WRITE = FLAG_READ | FLAG_WRITE.
> ffmpeg just imitated it.
>
>>> url_exist
>> This function is problematic:
>> http://thread.gmane.org/gmane.comp.video.ffmpeg.devel/102825
>
> Summary: the function opens to check for existence, this can be wrong (if
> the permissions are insufficient) or problematic (on FIFOs) in some
> situations.
>
> Having a mode of open that requests neither read nor write would be a
> solution to say that we want to just check for existence.

Existence checks are almost always wrong as by the time you act on the
information, it may already be stale, leaving the door open for race
conditions which may have serious security implications.

-- 
M?ns Rullg?rd
mans at mansr.com



More information about the ffmpeg-devel mailing list