From ecd144b63ed08b2fed2de90ca6e37bd04fdc5695 Mon Sep 17 00:00:00 2001 From: Kim Kulling Date: Tue, 9 Apr 2024 19:13:25 +0100 Subject: [PATCH] Update UnitTestFileGenerator.h --- test/unit/UnitTestFileGenerator.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/test/unit/UnitTestFileGenerator.h b/test/unit/UnitTestFileGenerator.h index 93007bad9..46d2113ab 100644 --- a/test/unit/UnitTestFileGenerator.h +++ b/test/unit/UnitTestFileGenerator.h @@ -54,14 +54,15 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include inline FILE* MakeTmpFile(char* tmplate) { - auto pathtemplate = _mktemp(tmplate); + auto pathtemplate = _mktemp_s(tmplate, std::strlen(tmplate)); EXPECT_NE(pathtemplate, nullptr); if(pathtemplate == nullptr) { return nullptr; } - auto* fs = std::fopen(pathtemplate, "w+"); - EXPECT_NE(fs, nullptr); + FILE *fs = nullptr; + auto err = fopen_s(&fs, pathtemplate, "w+"); + EXPECT_EQ(err, 0); return fs; } #elif defined(__GNUC__) || defined(__clang__)