[vlc-devel] [PATCH 1/4] test/url: check $TMPDIR first and then fallback to /tmp
Zhao Zhili
quinkblack at foxmail.com
Wed Feb 3 17:04:23 UTC 2021
From: Zhao Zhili <zhilizhao at tencent.com>
---
src/test/url.c | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/src/test/url.c b/src/test/url.c
index 5f31047c2d..158a25aa68 100644
--- a/src/test/url.c
+++ b/src/test/url.c
@@ -224,14 +224,17 @@ int main (void)
assert (fd != -1);*/
#ifndef _WIN32 /* FIXME: deal with anti-slashes */
- if (chdir ("/tmp"))
+ const char *tmpdir = getenv("TMPDIR");
+ if (tmpdir == NULL)
+ tmpdir = "/tmp";
+ if (chdir (tmpdir))
{
- perror("/tmp");
+ perror(tmpdir);
exit(1);
}
- char buf[256];
- char *tmpdir = getcwd(buf, ARRAY_SIZE (buf));
+ char buf[512];
+ tmpdir = getcwd(buf, ARRAY_SIZE (buf));
if (tmpdir == NULL)
{
perror("getcwd");
--
2.27.0
More information about the vlc-devel
mailing list