[vlc-devel] [PATCH v3 6/14] es_out_timeshift: use config_GetTempPath() in GetTmpFile()

Lyndon Brown jnqnfe at gmail.com
Wed Oct 14 04:53:55 CEST 2020


From: Lyndon Brown <jnqnfe at gmail.com>
Date: Mon, 5 Oct 2020 23:02:12 +0100
Subject: es_out_timeshift: use config_GetTempPath() in GetTmpFile()


diff --git a/src/input/es_out_timeshift.c b/src/input/es_out_timeshift.c
index 82aa2da137..ceb0da2778 100644
--- a/src/input/es_out_timeshift.c
+++ b/src/input/es_out_timeshift.c
@@ -39,6 +39,7 @@
 
 #include <vlc_common.h>
 #include <vlc_fs.h>
+#include <vlc_configuration.h>
 #include <vlc_mouse.h>
 #ifdef _WIN32
 #  include <vlc_charset.h>
@@ -1809,11 +1810,15 @@ static int CmdExecutePrivControl( es_out_t *p_tsout, ts_cmd_privcontrol_t *p_cmd
 
 static int GetTmpFile( char **path, const char *directory )
 {
-    if (directory == NULL)
-        return GetTmpFile(path, DIR_SEP"tmp");
+    int fd = -1;
+    if (directory == NULL) {
+        char *tmpdir = config_GetTempPath();
+        fd = GetTmpFile(path, tmpdir);
+        free(tmpdir);
+        return fd;
+    }
     vlc_mkdir(directory, 0700);
 
-    int fd = -1;
     if (asprintf(path, "%s" DIR_SEP PACKAGE_NAME "-timeshift.XXXXXX", directory) >= 0) {
         fd = vlc_mkstemp(*path);
         if (fd == -1)



More information about the vlc-devel mailing list