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