[vlc-devel] [PATCH] record: use vlc_mkstemp instead of tempnam
Rémi Denis-Courmont
remi at remlab.net
Mon Sep 28 09:20:44 CEST 2020
Hi,
Besides Steve's portability objections, this patch does not make much sense. It suffers from the exact same problems as the existing code, just more complicated and without a warning.
Le 27 septembre 2020 23:30:20 GMT+03:00, Lyndon Brown <jnqnfe at gmail.com> a écrit :
>attached. preview:
>
>From: Lyndon Brown <jnqnfe at gmail.com>
>Date: Fri, 29 Mar 2019 14:31:38 +0000
>Subject: record: use vlc_mkstemp instead of tempnam
>
>resolves compile warning about insecure function
>
>diff --git a/modules/stream_out/record.c b/modules/stream_out/record.c
>index ce2ce958e7..f205c610f6 100644
>--- a/modules/stream_out/record.c
>+++ b/modules/stream_out/record.c
>@@ -465,10 +465,20 @@ static void OutputStart( sout_stream_t *p_stream
>)
> char *psz_file;
> int i_es;
>
>- psz_file = tempnam( NULL, "vlc" );
>+ psz_file = strdup(
>DIR_SEP"tmp"DIR_SEP"vlc-recording.XXXXXX" );
> if( !psz_file )
> continue;
>
>+ int fd = vlc_mkstemp( psz_file );
>+
>+ if( fd == -1 )
>+ continue;
>+
>+ /* FIXME: unlink after creation, we only want to create it
>here,
>+ not hold it open since sout takes a path to open not an
>FD of
>+ an already open file */
>+ vlc_unlink( psz_file );
>+
> msg_Dbg( p_stream, "probing muxer %s", ppsz_muxers[i][0] );
> i_es = OutputNew( p_stream, ppsz_muxers[i][0], psz_file, NULL );
>
--
Envoyé de mon appareil Android avec Courriel K-9 Mail. Veuillez excuser ma brièveté.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20200928/3af80933/attachment.html>
More information about the vlc-devel
mailing list