aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRamiro Polla <ramiro.polla@gmail.com>2007-07-11 13:57:22 +0000
committerRamiro Polla <ramiro.polla@gmail.com>2007-07-11 13:57:22 +0000
commit6ffa87d3254dd8bdc31b50b378e1cf59c5dc13e5 (patch)
tree47a4880995c8a7567d2a649c79a3dab0e924f798
parent7c9dcd4bba43f5ff489227abdb65790738a18af1 (diff)
downloadffmpeg-6ffa87d3254dd8bdc31b50b378e1cf59c5dc13e5.tar.gz
Proper check for mkstemp().
Originally committed as revision 9596 to svn://svn.ffmpeg.org/ffmpeg/trunk
-rwxr-xr-xconfigure3
-rw-r--r--libavcodec/utils.c6
2 files changed, 6 insertions, 3 deletions
diff --git a/configure b/configure
index 50be51d383..fd887b4df2 100755
--- a/configure
+++ b/configure
@@ -673,6 +673,7 @@ HAVE_LIST="
machine_ioctl_meteor_h
malloc_h
memalign
+ mkstemp
mlib
ppc64
sdl
@@ -1507,6 +1508,8 @@ fi
check_header byteswap.h
+check_func mkstemp
+
check_header arpa/inet.h
check_func inet_aton
diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index 4d6ed7777c..cd2037884d 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -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);