parent
2fe5ddfdae
commit
671bcb34e2
|
@ -141,7 +141,7 @@ AC_TYPE_PID_T
|
|||
# Checks for library functions.
|
||||
AC_FUNC_VPRINTF
|
||||
AC_FUNC_MMAP
|
||||
AC_CHECK_FUNCS([link mkstemp mkostemp _mktemp_s getopt getopt_long getprogname rand random lrand48 random_r rand_r realpath regcomp regerror regexec regfree fstatvfs fstatfs lstat])
|
||||
AC_CHECK_FUNCS([link mkstemp mkostemp _mktemp_s getopt getopt_long getprogname 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.
|
||||
|
|
|
@ -140,23 +140,23 @@ retry:
|
|||
|
||||
prgname = FcStrdup (p);
|
||||
}
|
||||
#elif defined (HAVE_GETPROGNAME)
|
||||
const char *q = getprogname ();
|
||||
if (q)
|
||||
prgname = FcStrdup (q);
|
||||
else
|
||||
prgname = FcStrdup ("");
|
||||
#else
|
||||
char buf[PATH_MAX + 1];
|
||||
unsigned int len;
|
||||
char *p = NULL;
|
||||
|
||||
#if defined (HAVE_GETPROGNAME) && defined (HAVE_REALPATH)
|
||||
const char *q = getprogname ();
|
||||
if (q)
|
||||
p = realpath (q, buf);
|
||||
#else
|
||||
len = readlink ("/proc/self/exe", buf, sizeof (buf) - 1);
|
||||
if (len > 0)
|
||||
{
|
||||
buf[len] = '\0';
|
||||
p = buf;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (p)
|
||||
{
|
||||
|
@ -171,12 +171,12 @@ retry:
|
|||
|
||||
if (!prgname)
|
||||
prgname = FcStrdup ("");
|
||||
#endif
|
||||
|
||||
if (!fc_atomic_ptr_cmpexch (&default_prgname, NULL, prgname)) {
|
||||
free (prgname);
|
||||
goto retry;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
if (prgname && !prgname[0])
|
||||
|
|
Loading…
Reference in New Issue