From 9925cbe30e24e49a0fba1ddc5c37b3f79c664759 Mon Sep 17 00:00:00 2001 From: Steve Hannah Date: Tue, 29 Dec 2020 18:20:11 -0800 Subject: [PATCH 1/2] Made temp directory creation respect the TMPDIR environment variable rather than forcing it inside /tmp directory. When running inside some sandboxed environments /tmp will not be available. --- src/utils2.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/utils2.c b/src/utils2.c index 3bacf8fae..57c33e98f 100644 --- a/src/utils2.c +++ b/src/utils2.c @@ -3308,7 +3308,11 @@ size_t pathlen; dir = pathJoin(result, subdir); } #else - dir = pathJoin("/tmp", subdir); + char *tmpDir = getenv("TMPDIR"); + if (tmpDir == NULL) { + tmpDir = "/tmp"; + } + dir = pathJoin(tmpDir, subdir); #endif /* ~ OS_IOS */ #ifndef _WIN32 From 6128c2a11cad66dc41866c38854cefab393c5497 Mon Sep 17 00:00:00 2001 From: Steve Hannah Date: Wed, 30 Dec 2020 07:43:07 -0800 Subject: [PATCH 2/2] Wrapped section in block for C89 compatibility. --- src/utils2.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/utils2.c b/src/utils2.c index 57c33e98f..d424e0e22 100644 --- a/src/utils2.c +++ b/src/utils2.c @@ -3308,11 +3308,14 @@ size_t pathlen; dir = pathJoin(result, subdir); } #else - char *tmpDir = getenv("TMPDIR"); - if (tmpDir == NULL) { - tmpDir = "/tmp"; + { + char *tmpDir = getenv("TMPDIR"); + if (tmpDir == NULL) { + tmpDir = "/tmp"; + } + dir = pathJoin(tmpDir, subdir); } - dir = pathJoin(tmpDir, subdir); + #endif /* ~ OS_IOS */ #ifndef _WIN32