Proper check for mkstemp().

Originally committed as revision 9596 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
Ramiro Polla 2007-07-11 13:57:22 +00:00
parent 7c9dcd4bba
commit 6ffa87d325
2 changed files with 6 additions and 3 deletions

View file

@ -34,7 +34,7 @@
#include <stdarg.h>
#include <limits.h>
#include <float.h>
#ifdef __MINGW32__
#if !defined(HAVE_MKSTEMP)
#include <fcntl.h>
#endif
@ -1333,7 +1333,7 @@ unsigned int av_xiphlacing(unsigned char *s, unsigned int v)
* and opened file name in **filename. */
int av_tempfile(char *prefix, char **filename) {
int fd=-1;
#ifdef __MINGW32__
#if !defined(HAVE_MKSTEMP)
*filename = tempnam(".", prefix);
#else
size_t len = strlen(prefix) + 12; /* room for "/tmp/" and "XXXXXX\0" */
@ -1344,7 +1344,7 @@ int av_tempfile(char *prefix, char **filename) {
av_log(NULL, AV_LOG_ERROR, "ff_tempfile: Cannot allocate file name\n");
return -1;
}
#ifdef __MINGW32__
#if !defined(HAVE_MKSTEMP)
fd = open(*filename, _O_RDWR | _O_BINARY | _O_CREAT, 0444);
#else
snprintf(*filename, len, "/tmp/%sXXXXXX", prefix);