[Fontconfig] fontconfig: Branch 'master'

Akira TAGOH tagoh at kemper.freedesktop.org
Tue Jan 15 23:36:10 PST 2013


 configure.ac    |    2 +-
 src/fcdefault.c |   10 ++++++++++
 2 files changed, 11 insertions(+), 1 deletion(-)

New commits:
commit f9ac4c84c90cbb57afbf1fa3a5c9ff3bfc4f537e
Author: Akira TAGOH <akira at tagoh.org>
Date:   Wed Jan 16 16:35:28 2013 +0900

    Improve FcGetPrgname() to work on BSD

diff --git a/configure.ac b/configure.ac
index a520ae7..43a4312 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 _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.
diff --git a/src/fcdefault.c b/src/fcdefault.c
index aa47840..88978b8 100644
--- a/src/fcdefault.c
+++ b/src/fcdefault.c
@@ -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;


More information about the Fontconfig mailing list