Fix a build issue on Solaris 10

Use own mkdtemp implementation if not available.

Reported by Thomas Klausner and Jörn Clausen
This commit is contained in:
Akira TAGOH 2013-10-24 19:35:26 +09:00
parent 76ea9af816
commit 65872e9e46
2 changed files with 15 additions and 2 deletions

View File

@ -148,7 +148,7 @@ AC_TYPE_PID_T
# Checks for library functions. # Checks for library functions.
AC_FUNC_VPRINTF AC_FUNC_VPRINTF
AC_FUNC_MMAP AC_FUNC_MMAP
AC_CHECK_FUNCS([link mkstemp mkostemp _mktemp_s getopt getopt_long getprogname getexecname rand random lrand48 random_r rand_r regcomp regerror regexec regfree fstatvfs fstatfs lstat]) AC_CHECK_FUNCS([link mkstemp mkostemp _mktemp_s mkdtemp getopt getopt_long getprogname getexecname 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 AC_CHECK_FUNCS doesn't check for header files.
dnl posix_fadvise() may be not available in older libc. dnl posix_fadvise() may be not available in older libc.

View File

@ -11,6 +11,19 @@
#endif #endif
#include <fontconfig/fontconfig.h> #include <fontconfig/fontconfig.h>
#ifdef HAVE_MKDTEMP
#define fc_mkdtemp mkdtemp
#else
char *
fc_mkdtemp (char *template)
{
if (!mktemp (template) || mkdir (template, 0700))
return NULL;
return template;
}
#endif
FcBool FcBool
mkdir_p(const char *dir) mkdir_p(const char *dir)
{ {
@ -107,7 +120,7 @@ int
main(void) main(void)
{ {
char template[32] = "fontconfig-XXXXXXXX"; char template[32] = "fontconfig-XXXXXXXX";
char *tmp = mkdtemp (template); char *tmp = fc_mkdtemp (template);
size_t len = strlen (tmp), xlen, dlen; size_t len = strlen (tmp), xlen, dlen;
char xdg[256], confd[256], fn[256], nfn[256], ud[256], nud[256]; char xdg[256], confd[256], fn[256], nfn[256], ud[256], nud[256];
int ret = -1; int ret = -1;