fixes mkstemp file handle-leaking behavior (#529)

This commit is contained in:
Sam Hatchett
2019-09-25 10:47:38 -04:00
committed by GitHub
parent 9f1634a23c
commit 647abd71c1

View File

@@ -14,6 +14,7 @@
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
//*** For the Windows SDK _tempnam function ***//
#ifdef _WIN32
@@ -1091,8 +1092,11 @@ char *getTmpName(char *fname)
// --- for non-Windows systems:
#else
// --- use system function mkstemp() to create a temporary file name
int f = -1;
strcpy(fname, "enXXXXXX");
mkstemp(fname);
f = mkstemp(fname);
close(f);
remove(fname);
#endif
return fname;
}