summaryrefslogtreecommitdiffstats
path: root/src/test.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/test.cc')
-rw-r--r--src/test.cc13
1 files changed, 2 insertions, 11 deletions
diff --git a/src/test.cc b/src/test.cc
index 8ba2297..021005e 100644
--- a/src/test.cc
+++ b/src/test.cc
@@ -24,6 +24,7 @@
#include <stdlib.h>
#ifdef _WIN32
#include <windows.h>
+#include <io.h>
#else
#include <unistd.h>
#endif
@@ -45,19 +46,9 @@ extern "C" {
namespace {
#ifdef _WIN32
-#ifndef _mktemp_s
-/// mingw has no mktemp. Implement one with the same type as the one
-/// found in the Windows API.
-int _mktemp_s(char* templ) {
- char* ofs = strchr(templ, 'X');
- sprintf(ofs, "%d", rand() % 1000000);
- return 0;
-}
-#endif
-
/// Windows has no mkdtemp. Implement it in terms of _mktemp_s.
char* mkdtemp(char* name_template) {
- int err = _mktemp_s(name_template);
+ int err = _mktemp_s(name_template, strlen(name_template) + 1);
if (err < 0) {
perror("_mktemp_s");
return NULL;