Skip to content

Commit 6e81ecc

Browse files
committed
fixup
1 parent a03a885 commit 6e81ecc

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

tests/tools.c

+10-3
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ static const char *get_tmpdir(const char *dir)
3535
{
3636
const char *tmpdir = NULL;
3737

38-
#if _WIN32
39-
tmpdir = getenv("TMP");
38+
#if _MSC_VER
39+
tmpdir = _getenv("TMP");
4040
#else
4141
tmpdir = getenv("TMPDIR");
4242
#endif
@@ -61,8 +61,15 @@ char *get_tempnam(const char *dir, const char *pfx)
6161
return NULL;
6262

6363
static unsigned int count = 0;
64+
unsigned int pid;
65+
66+
#if _MSC_VER
67+
pid = (unsigned int)_getpid();
68+
#else
69+
pid = (unsigned int)getpid();
70+
#endif
6471

65-
srand((unsigned int)getpid() + count++);
72+
srand(pid + count++);
6673

6774
for (unsigned int i = 0; i < 1000; i++) {
6875
char tmp[16];

0 commit comments

Comments
 (0)