summaryrefslogtreecommitdiff
path: root/tests-clar/clar/sandbox.h
diff options
context:
space:
mode:
Diffstat (limited to 'tests-clar/clar/sandbox.h')
-rw-r--r--tests-clar/clar/sandbox.h12
1 files changed, 8 insertions, 4 deletions
diff --git a/tests-clar/clar/sandbox.h b/tests-clar/clar/sandbox.h
index bed3011fe..1ca6fcae8 100644
--- a/tests-clar/clar/sandbox.h
+++ b/tests-clar/clar/sandbox.h
@@ -18,9 +18,9 @@ static int
find_tmp_path(char *buffer, size_t length)
{
#ifndef _WIN32
- static const size_t var_count = 4;
+ static const size_t var_count = 5;
static const char *env_vars[] = {
- "TMPDIR", "TMP", "TEMP", "USERPROFILE"
+ "CLAR_TMP", "TMPDIR", "TMP", "TEMP", "USERPROFILE"
};
size_t i;
@@ -43,6 +43,12 @@ find_tmp_path(char *buffer, size_t length)
}
#else
+ DWORD env_len;
+
+ if ((env_len = GetEnvironmentVariable("CLAR_TMP", buffer, length)) > 0 &&
+ env_len < length)
+ return 0;
+
if (GetTempPath((DWORD)length, buffer))
return 0;
#endif
@@ -61,9 +67,7 @@ static void clar_unsandbox(void)
if (_clar_path[0] == '\0')
return;
-#ifdef _WIN32
chdir("..");
-#endif
fs_rm(_clar_path);
}