SHA256
1
0
forked from pool/csound
csound/csound-tmpnam-fix.diff

25 lines
785 B
Diff

--- Top/one_file.c-dist 2006-10-13 12:31:47.000000000 +0200
+++ Top/one_file.c 2007-01-22 12:06:54.000000000 +0100
@@ -24,6 +24,7 @@
#include "csoundCore.h"
#include <ctype.h>
#include <errno.h>
+#include <stdlib.h>
#if defined(LINUX) || defined(__MACH__) || defined(WIN32)
# include <sys/types.h>
# include <sys/stat.h>
@@ -74,8 +75,11 @@ CS_NOINLINE char *csoundTmpFileName(CSOU
do {
#endif
#ifndef WIN32
- if (tmpnam(buf) == NULL)
- csound->Die(csound, Str(" *** cannot create temporary file"));
+ int fd;
+ strcpy(buf, "/tmp/csoundXXXXXX");
+ if ((fd = mkstemp(buf)) < 0)
+ csound->Die(csound, Str(" *** cannot create temporary file"));
+ close(fd);
#else
{
char *s = (char*) csoundGetEnv(csound, "SFDIR");