summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorPierre Joye <pierre.php@gmail.com>2021-08-28 11:11:44 +0700
committerPierre Joye <pierre.php@gmail.com>2021-08-28 11:11:44 +0700
commit9e02f643251743d523f1f1c53e02f8cdc97c8191 (patch)
treec3e833a0c40aa735b3db6faff47343f563047a46 /tests
parent9f597cb6d9ee30ff2b7cd28f0f3b192f94497456 (diff)
downloadlibgd-9e02f643251743d523f1f1c53e02f8cdc97c8191.tar.gz
fix linux variants mkdstemp
Diffstat (limited to 'tests')
-rw-r--r--tests/gdtest/gdtest.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/tests/gdtest/gdtest.c b/tests/gdtest/gdtest.c
index 92064d9..e2a2582 100644
--- a/tests/gdtest/gdtest.c
+++ b/tests/gdtest/gdtest.c
@@ -301,12 +301,12 @@ const char *gdTestTempDir(void)
// Mingw defines it
tmpdir_root = getenv("TMP");
if (tmpdir_root == NULL) {
+#if defined(__MINGW32__) || defined(__MINGW64__)
// On MingW it seems we fail too often. Let default to this and create it ourselves
tmpdir_root = "./tmp";
-#if defined(__MINGW32__) || defined(__MINGW64__)
- if (mkdir(tmpdir_root) == 0) {
+ if (!gdTestIsDir(tmpdir_root) && mkdir(tmpdir_root) == 0) {
#else
- if (mkdir(tmpdir_root, 0700) == 0) {
+ if (!gdTestIsDir(tmpdir_root) && mkdir(tmpdir_root, 0700) == 0) {
#endif
printf("tmpdir failed to be used or initialized (%s).", tmpdir_root);
exit(2);