Fix a build fail on mingw
authorAkira TAGOH <akira@tagoh.org>
Tue, 8 Jan 2013 07:20:28 +0000 (16:20 +0900)
committerAkira TAGOH <akira@tagoh.org>
Tue, 8 Jan 2013 07:20:40 +0000 (16:20 +0900)
Regarding the change of 596931c8b4a7a35cbff9c33437d3cd44395d9c3f

configure.ac
src/fccompat.c

index 783fbf6..803084c 100644 (file)
@@ -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.
index b976007..169cab9 100644 (file)
@@ -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