aboutsummaryrefslogtreecommitdiff
path: root/fontconfig
diff options
context:
space:
mode:
Diffstat (limited to 'fontconfig')
-rw-r--r--fontconfig/configure.ac2
-rw-r--r--fontconfig/src/fccache.c7
-rw-r--r--fontconfig/src/fccfg.c4
-rw-r--r--fontconfig/src/fcdefault.c28
-rw-r--r--fontconfig/src/fcfreetype.c3
5 files changed, 30 insertions, 14 deletions
diff --git a/fontconfig/configure.ac b/fontconfig/configure.ac
index a520ae70d..e8ee55916 100644
--- a/fontconfig/configure.ac
+++ b/fontconfig/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([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.
diff --git a/fontconfig/src/fccache.c b/fontconfig/src/fccache.c
index ddcf07030..610b8f0b7 100644
--- a/fontconfig/src/fccache.c
+++ b/fontconfig/src/fccache.c
@@ -449,6 +449,9 @@ FcCacheFindByAddrUnlocked (void *object)
FcCacheSkip **next = fcCacheChains;
FcCacheSkip *s;
+ if (!object)
+ return NULL;
+
/*
* Walk chain pointers one level at a time
*/
@@ -556,7 +559,7 @@ FcCacheObjectDereference (void *object)
skip = FcCacheFindByAddrUnlocked (object);
if (skip)
{
- if (FcRefDec (&skip->ref) <= 1)
+ if (FcRefDec (&skip->ref) == 1)
FcDirCacheDisposeUnlocked (skip->cache);
}
unlock_cache ();
@@ -1109,6 +1112,7 @@ FcDirCacheClean (const FcChar8 *cache_dir, FcBool verbose)
cache_dir, ent->d_name, target_dir);
remove = FcTrue;
}
+ FcDirCacheUnload (cache);
}
if (remove)
{
@@ -1118,7 +1122,6 @@ FcDirCacheClean (const FcChar8 *cache_dir, FcBool verbose)
ret = FcFalse;
}
}
- FcDirCacheUnload (cache);
FcStrFree (file_name);
}
diff --git a/fontconfig/src/fccfg.c b/fontconfig/src/fccfg.c
index 3e9fdaba4..12d7e1a97 100644
--- a/fontconfig/src/fccfg.c
+++ b/fontconfig/src/fccfg.c
@@ -337,8 +337,8 @@ FcConfigAddCache (FcConfig *config, FcCache *cache,
if (!FcConfigAcceptFont (config, font))
continue;
- nref++;
- FcFontSetAdd (config->fonts[set], font);
+ if (FcFontSetAdd (config->fonts[set], font))
+ nref++;
}
FcDirCacheReference (cache, nref);
}
diff --git a/fontconfig/src/fcdefault.c b/fontconfig/src/fcdefault.c
index aa47840d1..b1bd9cc1f 100644
--- a/fontconfig/src/fcdefault.c
+++ b/fontconfig/src/fcdefault.c
@@ -23,6 +23,7 @@
*/
#include "fcint.h"
+#include <limits.h>
#include <string.h>
/* MT-safe */
@@ -139,27 +140,38 @@ retry:
prgname = FcStrdup (p);
}
+#elif defined (HAVE_GETPROGNAME)
+ const char *q = getprogname ();
+ if (q)
+ prgname = FcStrdup (q);
+ else
+ prgname = FcStrdup ("");
#else
- char buf[8192];
+ char buf[PATH_MAX + 1];
unsigned int len;
+ char *p = NULL;
len = readlink ("/proc/self/exe", buf, sizeof (buf) - 1);
if (len > 0)
{
- char *p;
+ buf[len] = '\0';
+ p = buf;
+ }
- p = strrchr (buf, '/');
- if (p)
- p++;
+ if (p)
+ {
+ char *r = strrchr (p, '/');
+ if (r)
+ r++;
else
- p = buf;
+ r = p;
- prgname = FcStrdup (p);
+ prgname = FcStrdup (r);
}
-#endif
if (!prgname)
prgname = FcStrdup ("");
+#endif
if (!fc_atomic_ptr_cmpexch (&default_prgname, NULL, prgname)) {
free (prgname);
diff --git a/fontconfig/src/fcfreetype.c b/fontconfig/src/fcfreetype.c
index 9ac2fa901..faf3c350c 100644
--- a/fontconfig/src/fcfreetype.c
+++ b/fontconfig/src/fcfreetype.c
@@ -1706,7 +1706,8 @@ FcFreeTypeQueryFace (const FT_Face face,
{
const char *font_format = FT_Get_X11_Font_Format (face);
if (font_format)
- FcPatternAddString (pat, FC_FONTFORMAT, (FcChar8 *) font_format);
+ if (!FcPatternAddString (pat, FC_FONTFORMAT, (FcChar8 *) font_format))
+ goto bail2;
}
#endif