Improve FcGetPrgname() to work on BSD
This commit is contained in:
parent
ec5ca08c80
commit
f9ac4c84c9
|
@ -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 _mktemp_s strchr strrchr strtol getopt getopt_long sysconf ftruncate chsize rand random lrand48 random_r rand_r regcomp regerror readlink regexec regfree fstatvfs fstatfs lstat])
|
||||
AC_CHECK_FUNCS([geteuid getuid link memmove memset mkstemp mkostemp _mktemp_s strchr strrchr strtol getopt getopt_long getprogname sysconf ftruncate chsize rand random lrand48 random_r rand_r realpath regcomp regerror readlink 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.
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
*/
|
||||
|
||||
#include "fcint.h"
|
||||
#include <limits.h>
|
||||
#include <string.h>
|
||||
|
||||
/* MT-safe */
|
||||
|
@ -139,6 +140,15 @@ retry:
|
|||
|
||||
prgname = FcStrdup (p);
|
||||
}
|
||||
#elif defined (HAVE_GETPROGNAME) && defined (HAVE_REALPATH)
|
||||
const char *p = getprogname ();
|
||||
char resolved_path[PATH_MAX + 1];
|
||||
|
||||
if (p)
|
||||
{
|
||||
if (realpath (p, resolved_path) != NULL)
|
||||
prgname = FcStrdup (resolved_path);
|
||||
}
|
||||
#else
|
||||
char buf[8192];
|
||||
unsigned int len;
|
||||
|
|
Loading…
Reference in New Issue