[FFmpeg-devel] [RFC] av_tempfile()

Reimar Döffinger Reimar.Doeffinger at gmx.de
Sun Oct 16 19:32:55 CEST 2011

On Sun, Oct 16, 2011 at 03:31:07PM +0200, Michael Niedermayer wrote:
> Hi
> I think ff_tempfile() should be in libavutil as its a generically
> usefull thing and i will also need it from libavformat. Currently
> its only compiled when we link to xvid.
> Ill move it to libavutil soon, but i wont update the version yet, only
> once there is agreement (or lack of disagreement) on name, API and
> place

I seem to remember some issues with it, so I wouldn't like too much for
it become critical.
The issues I see on a quick look are that the non-mkstemp fallback might
result in overall code being unsafe, that it will always create the file
in "." in that case.
For the mkstemp code that it always tries /tmp which is not really
appropriate for Windows, that it does not respect TEMPDIR or any of the
other ones like that (note: I have more than once worked on systems
where tmp was accessible but had performance that made it unusable),
and it falls back to trying to create a file in "." for which I think
there is more than one reason to dislike.
Mostly I do not like of libav* creating any kind of file at all, ever,
or if there is no alternative at all it should be something like mkstemp
except that it will at also atomically unlink the file before returning
its descriptor.

More information about the ffmpeg-devel mailing list