[vlc-devel] [PATCH v2 13/13] vorepository: use vlc_MakeTmpFile (thus mkstemp) instead of tempnam

Lyndon Brown jnqnfe at gmail.com
Fri Oct 9 08:27:45 CEST 2020

On Tue, 2020-10-06 at 18:10 +0300, RĂ©mi Denis-Courmont wrote:
> I don't see why this code needs to have a temporary file name
> at all. 
> In this particular case, tempnam() looks like just a ugly lazy hack:
> the file 
> name is never given to an external process that would somehow need a
> file name.

I've just been taking another look at this module to assess getting rid
of the filename based upon your suggestion here of the filename not
being needed. It may not be given to an external process as you say,
but further down in the function it's used in creating a stream to get
at the manifest file.

The file path with appended `#!/manifest.xml` gets pushed through
stream extractor functions, and without spending too much time figuring
out what's going on through all of that, I think I'm right in believing
that the addon is an archive file and the stream extractor is
retrieving the manifest.xml file from within it.

As I see it, ditching the filename considering this use of it would
require building some way of passing an FD/FILE* into the stream
creation routines for them to re-use, as an alternative to providing a
path to open, which I'm sure is not wanted.

More information about the vlc-devel mailing list