[vlc-devel] [PATCH v2 10/13] esout: make use of vlc_MakeTmpFile() in GetTmpFile()

Lyndon Brown jnqnfe at gmail.com
Tue Oct 6 08:00:52 CEST 2020


From: Lyndon Brown <jnqnfe at gmail.com>
Date: Tue, 6 Oct 2020 01:29:51 +0100
Subject: esout: make use of vlc_MakeTmpFile() in GetTmpFile()


diff --git a/src/input/es_out_timeshift.c b/src/input/es_out_timeshift.c
index 8300d4f712..e22ffafb5c 100644
--- a/src/input/es_out_timeshift.c
+++ b/src/input/es_out_timeshift.c
@@ -39,7 +39,6 @@
 
 #include <vlc_common.h>
 #include <vlc_fs.h>
-#include <vlc_configuration.h>
 #include <vlc_mouse.h>
 #ifdef _WIN32
 #  include <vlc_charset.h>
@@ -1823,26 +1822,9 @@ static int CmdExecutePrivControl( es_out_t *p_tsout, ts_cmd_privcontrol_t *p_cmd
 
 static int GetTmpFile( char **path, const char *directory )
 {
-    char *dir_actual;
-    if (directory != NULL) {
-        dir_actual = (char *)directory;
+    if (directory != NULL)
         vlc_mkdir(directory, 0700);
-    }
-    else {
-        dir_actual = config_GetTempPath();
-        if (dir_actual == NULL)
-            return -1;
-    }
 
-    int fd = -1;
     const char *filetemplate = PACKAGE_NAME"-timeshift.XXXXXX";
-    if (asprintf(path, "%s"DIR_SEP"%s", dir_actual, filetemplate) >= 0) {
-        fd = vlc_mkstemp(*path);
-        if (fd == -1)
-            free(*path);
-    }
-
-    if (directory == NULL)
-        free(dir_actual);
-    return fd;
+    return vlc_MakeTmpFile(path, filetemplate, directory);
 }



More information about the vlc-devel mailing list