diff --git a/tests/test_document.cpp b/tests/test_document.cpp
index 3dc2d02..a34513e 100644
--- a/tests/test_document.cpp
+++ b/tests/test_document.cpp
@@ -382,6 +382,8 @@ TEST_XML(document_save_declaration_latin1, "")
CHECK(writer.as_narrow() == "\n\n");
}
+#define USE_MKSTEMP defined(__unix) || defined(__QNX__)
+
struct temp_file
{
char path[512];
@@ -389,7 +391,7 @@ struct temp_file
temp_file(): fd(0)
{
- #ifdef __unix
+ #if USE_MKSTEMP
strcpy(path, "/tmp/pugiXXXXXX");
fd = mkstemp(path);
@@ -407,7 +409,7 @@ struct temp_file
CHECK(unlink(path) == 0);
#endif
- #ifdef __unix
+ #if USE_MKSTEMP
CHECK(close(fd) == 0);
#endif
}