clar: use a custom temp directory name
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 7da4a89..3dda331 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -454,6 +454,7 @@ IF (BUILD_CLAR)
SET(CLAR_RESOURCES "${CMAKE_CURRENT_SOURCE_DIR}/tests/resources" CACHE PATH "Path to test resources.")
ADD_DEFINITIONS(-DCLAR_FIXTURE_PATH=\"${CLAR_FIXTURES}\")
ADD_DEFINITIONS(-DCLAR_RESOURCES=\"${TEST_RESOURCES}\")
+ ADD_DEFINITIONS(-DCLAR_TMPDIR=\"libgit2_tests\")
INCLUDE_DIRECTORIES(${CLAR_PATH})
FILE(GLOB_RECURSE SRC_TEST ${CLAR_PATH}/*/*.c ${CLAR_PATH}/*/*.h)
diff --git a/tests/clar/sandbox.h b/tests/clar/sandbox.h
index a44e291..ea9e35c 100644
--- a/tests/clar/sandbox.h
+++ b/tests/clar/sandbox.h
@@ -72,7 +72,12 @@ static void clar_unsandbox(void)
static int build_sandbox_path(void)
{
+#ifdef CLAR_TMPDIR
+ const char path_tail[] = CLAR_TMPDIR "_XXXXXX";
+#else
const char path_tail[] = "clar_tmp_XXXXXX";
+#endif
+
size_t len;
if (find_tmp_path(_clar_path, sizeof(_clar_path)) < 0)