diff --git a/common/file_util.cc b/common/file_util.cc index 0bed848..9c17ec8 100644 --- a/common/file_util.cc +++ b/common/file_util.cc @@ -12,6 +12,7 @@ #include // close() #endif +#include #include #include #include @@ -29,9 +30,12 @@ std::string GetTempFileName() { } return std::string(); #else - // TODO(tomfinegan): Add the MSVC version of mkstemp() to quiet the MSVC - // version of the security warning. - return std::tmpnam(nullptr); + char tmp_file_name[_MAX_PATH]; + errno_t err = tmpnam_s(tmp_file_name); + if (err == 0) { + return std::string(tmp_file_name); + } + return std::string(); #endif }