@@ -415,7 +415,11 @@ ns_set_environment_variable(const string &var, const string &value) {
// putenv() requires us to malloc a new C-style string.
char *put = (char *)malloc(putstr.length() + 1);
strcpy(put, putstr.c_str());
+#ifdef _MSC_VER
+ _putenv(put);
+#else
putenv(put);
+#endif
}
/**
@@ -433,7 +433,11 @@ temporary(const string &dirname, const string &prefix, const string &suffix,
if (fdirname.empty()) {
// If we are not given a dirname, use the system tempnam() function to
// create a system-defined temporary filename.
+ char *name = _tempnam(nullptr, prefix.c_str());
char *name = tempnam(nullptr, prefix.c_str());
Filename result = Filename::from_os_specific(name);
free(name);
result.set_type(type);