From 4e6c7d0827c5b3b20205521bf9bd2e94e704b36d Mon Sep 17 00:00:00 2001 From: Akira TAGOH Date: Tue, 8 Jan 2013 16:20:28 +0900 Subject: [PATCH] Fix a build fail on mingw Regarding the change of 596931c8b4a7a35cbff9c33437d3cd44395d9c3f --- configure.ac | 2 +- src/fccompat.c | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 783fbf6..803084c 100644 --- a/configure.ac +++ b/configure.ac @@ -141,7 +141,7 @@ AC_TYPE_PID_T # Checks for library functions. AC_FUNC_VPRINTF AC_FUNC_MMAP -AC_CHECK_FUNCS([geteuid getuid link memmove memset mkstemp mkostemp strchr strrchr strtol getopt getopt_long sysconf ftruncate chsize rand random lrand48 random_r rand_r regcomp regerror regexec regfree fstatvfs fstatfs lstat]) +AC_CHECK_FUNCS([geteuid getuid link memmove memset mkstemp mkostemp _mktemp_s strchr strrchr strtol getopt getopt_long sysconf ftruncate chsize rand random lrand48 random_r rand_r regcomp regerror regexec regfree fstatvfs fstatfs lstat]) dnl AC_CHECK_FUNCS doesn't check for header files. dnl posix_fadvise() may be not available in older libc. diff --git a/src/fccompat.c b/src/fccompat.c index b976007..169cab9 100644 --- a/src/fccompat.c +++ b/src/fccompat.c @@ -95,6 +95,10 @@ FcMakeTempfile (char *template) fcntl(fd, F_SETFD, fcntl(fd, F_GETFD) | FD_CLOEXEC); } # endif +#elif HAVE__MKTEMP_S + if (_mktemp_s(template, strlen(template) + 1) != 0) + return -1; + fd = FcOpen(template, O_RDWR | O_EXCL | O_CREAT, 0600); #else #error no secure functions to create a temporary file #endif