[vlc-devel] [PATCH v2 4/13] esout: refactor GetTmpFile()

Lyndon Brown jnqnfe at gmail.com
Fri Oct 9 08:30:15 CEST 2020

On Thu, 2020-10-08 at 22:30 +0300, Rémi Denis-Courmont wrote:
> Le torstaina 8. lokakuuta 2020, 9.45.04 EEST Lyndon Brown a écrit :
> > So are we keeping this option in which case we cannot in fact use
> > tmpfile(), or are you wanting that option ripped out?
> Personally I could hardly care less. It's buried in the deep in the
> preferences where hardly anyone will find it. Disk space is also not
> the same
> concern that it was 15 years ago when VLC grew timeshifting.


> But even if you want to maintain that capability, the thing is there
> is no
> proper abstraction for it in either the current code or your v2-
> patchset.
> > 2. tmpfile() does not open the file in O_EXCL mode.
> Sure it does.

Head smack moment. Sorry, I'm mixing up O_EXCL and opening with
exclusive access. It's the latter for which the table in the linked
article has a 'no' for tmpfile().

A discussion at the bottom of the page however suggests that the table
reflects requirements of the standards, which actual implementations
may improve upon, rather than the current state of practical safety,
and supposedly some POSIX implementations do have this property by
using mkstemp behind the scenes. So that all makes me more comfortable.

> > The C11 alternative tmpfile_s() does ("if supported by the OS") per
> > the
> > link in the next point, but I lack certainty of whether it's going
> > to
> > be available everywhere we need it.
> C11 Annex K is a pile of crap that is best ignored and avoided.


> We don't use fundamentally broken C interfaces, such as gets(). There
> is
> nothing fundamentally broken about tmpfile().

Regarding the Windows admin issue, a little further research still
turns up no clear answer, but some hints that it may have been fixed in
more recent versions of Windows/Visual-Studio.

Regarding the potentially buggy behaviour on Windows, I realised when I
woke up today that we can of course just use a loop to try a different
filename in the face of the failure scenario I mentioned.

So fine, I'll keep the tmpfile() change.

More information about the vlc-devel mailing list