[vlc-devel] [PATCH v2 5/13] esout: use config_GetTempPath() in GetTmpFile()

Lyndon Brown jnqnfe at gmail.com
Tue Oct 6 07:58:34 CEST 2020


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


diff --git a/src/input/es_out_timeshift.c b/src/input/es_out_timeshift.c
index 3cc38e0445..8300d4f712 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>
@@ -1822,13 +1823,16 @@ static int CmdExecutePrivControl( es_out_t *p_tsout, ts_cmd_privcontrol_t *p_cmd
 
 static int GetTmpFile( char **path, const char *directory )
 {
-    const char *dir_actual;
+    char *dir_actual;
     if (directory != NULL) {
-        dir_actual = directory;
+        dir_actual = (char *)directory;
         vlc_mkdir(directory, 0700);
     }
-    else
-        dir_actual = DIR_SEP"tmp";
+    else {
+        dir_actual = config_GetTempPath();
+        if (dir_actual == NULL)
+            return -1;
+    }
 
     int fd = -1;
     const char *filetemplate = PACKAGE_NAME"-timeshift.XXXXXX";
@@ -1837,5 +1841,8 @@ static int GetTmpFile( char **path, const char *directory )
         if (fd == -1)
             free(*path);
     }
+
+    if (directory == NULL)
+        free(dir_actual);
     return fd;
 }



More information about the vlc-devel mailing list