summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorPierre Joye <pierre.php@gmail.com>2021-08-28 12:00:04 +0700
committerPierre Joye <pierre.php@gmail.com>2021-08-28 12:00:04 +0700
commit6c38955d73e532a6deb40b62a44348dc295f8518 (patch)
tree9f716055c4bff76e22b819c14f5a7c6ebff20b7b /tests
parent49f3e0250ce2c984d2ce2583abaca63e6e3e42e9 (diff)
downloadlibgd-6c38955d73e532a6deb40b62a44348dc295f8518.tar.gz
for the tests, it seems mingw can fail too often to find/create the tmpidr, let default it to ./tmp and fail if it cannot be created/used
Diffstat (limited to 'tests')
-rw-r--r--tests/gdtest/gdtest.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/tests/gdtest/gdtest.c b/tests/gdtest/gdtest.c
index a902b64..12b3149 100644
--- a/tests/gdtest/gdtest.c
+++ b/tests/gdtest/gdtest.c
@@ -226,12 +226,6 @@ char* strrstr (char* haystack, char* needle)
static char *
mkdtemp (char *tmpl)
{
- static const char letters[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
- static const int NLETTERS = sizeof (letters) - 1;
- static int counter = 0;
- char *XXXXXX;
- struct timeval tv;
- __int64 value;
int count;
size_t l;
char attempts = 5;
@@ -283,7 +277,12 @@ const char *gdTestTempDir(void)
// Mingw defines it
tmpdir_root = getenv("TMP");
if (tmpdir_root == NULL) {
- tmpdir_root = "/tmp";
+ // On MingW it seems we fail too often. Let default to this and create it ourselves
+ tmpdir_root = "./tmp";
+ if (mkdir(tmpdir_root) == 0) {
+ printf("tmpdir failed to be used or initialized.");
+ exit(2);
+ }
}
}
#endif