Replace use of tmpnam which warns on linux at link time

This commit is contained in:
baldurk
2019-05-23 10:29:27 +01:00
parent 69e55628c2
commit e0275bc92b
4 changed files with 15 additions and 3 deletions
+6
View File
@@ -22,6 +22,7 @@
* THE SOFTWARE.
******************************************************************************/
#include <stdlib.h>
#include "test_common.h"
std::string GetCWD()
@@ -48,4 +49,9 @@ std::string GetEnvVar(const char *var)
return data;
return "";
}
void tmpnam_via_mkstemp(char (&buf)[MAX_PATH])
{
snprintf(buf, MAX_PATH - 1, "/tmp/rdoc_tmp/%x", rand());
}
+5 -1
View File
@@ -33,4 +33,8 @@
#define msleep(time) usleep((time)*1000)
#define EXECUTABLE_SUFFIX ""
#define EXECUTABLE_SUFFIX ""
#define get_tmpnam tmpnam_via_mkstemp
void tmpnam_via_mkstemp(char (&buf)[MAX_PATH]);
+2 -2
View File
@@ -300,8 +300,8 @@ std::vector<uint32_t> CompileShaderToSpv(const std::string &source_text, SPIRVTa
char infile[MAX_PATH] = {};
char outfile[MAX_PATH] = {};
tmpnam(infile);
tmpnam(outfile);
get_tmpnam(infile);
get_tmpnam(outfile);
command_line += " -o ";
command_line += outfile;
+2
View File
@@ -44,6 +44,8 @@ std::wstring UTF82Wide(const std::string &s);
#define popen _popen
#define pclose _pclose
#define get_tmpnam tmpnam_s
#define msleep(time) Sleep(time)
#define WEXITSTATUS(code) code