From 5b1ce40fa882e9cb8630b48032067a1ed2f1534f Mon Sep 17 00:00:00 2001 From: Toliver Date: Tue, 17 Sep 2024 21:56:32 +0900 Subject: [PATCH] server : use OS-generated temp file name for converted files (#2419) --- examples/server/server.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/examples/server/server.cpp b/examples/server/server.cpp index 02921763..60b96d49 100644 --- a/examples/server/server.cpp +++ b/examples/server/server.cpp @@ -677,7 +677,8 @@ int main(int argc, char ** argv) { if (sparams.ffmpeg_converter) { // if file is not wav, convert to wav // write to temporary file - const std::string temp_filename = "whisper_server_temp_file.wav"; + const std::string temp_filename_base = std::tmpnam(nullptr); + const std::string temp_filename = temp_filename_base + ".wav"; std::ofstream temp_file{temp_filename, std::ios::binary}; temp_file << audio_file.content; temp_file.close();