[vlc-devel] [PATCH v2 2/13] platform: obey $TMPDIR on posix/linux/darwin in config_GetTempPath()

Lyndon Brown jnqnfe at gmail.com
Tue Oct 6 07:57:04 CEST 2020


From: Lyndon Brown <jnqnfe at gmail.com>
Date: Tue, 6 Oct 2020 01:51:10 +0100
Subject: platform: obey $TMPDIR on posix/linux/darwin in config_GetTempPath()


diff --git a/src/darwin/dirs.m b/src/darwin/dirs.m
index 74e2183b7a..1c27b68370 100644
--- a/src/darwin/dirs.m
+++ b/src/darwin/dirs.m
@@ -233,5 +233,6 @@ char *config_GetUserDir (vlc_userdir_t type)
 
 char *config_GetTempPath(void)
 {
-    return strdup("/tmp");
+    char *dir = getenv("TMPDIR");
+    return strdup((dir != NULL) ? dir : "/tmp");
 }
diff --git a/src/posix/dirs.c b/src/posix/dirs.c
index 995be9b3ce..c4456edc73 100644
--- a/src/posix/dirs.c
+++ b/src/posix/dirs.c
@@ -300,5 +300,6 @@ char *config_GetUserDir (vlc_userdir_t type)
 
 char *config_GetTempPath(void)
 {
-    return strdup("/tmp");
+    char *dir = getenv("TMPDIR");
+    return strdup((dir != NULL) ? dir : "/tmp");
 }



More information about the vlc-devel mailing list