]> git.wh0rd.org - fontconfig.git/commitdiff
[fccache] Make sure the cache is current when reusing from open caches
authorBehdad Esfahbod <behdad@behdad.org>
Wed, 4 Feb 2009 02:06:15 +0000 (21:06 -0500)
committerBehdad Esfahbod <behdad@behdad.org>
Sun, 15 Feb 2009 21:40:25 +0000 (13:40 -0800)
Reported by Diego Santa Cruz.

src/fccache.c

index 53df860bd3f7b649513a8a1a68bb47947c8dbfe8..f35304a40cde1636a5b6d785c13593e13df227a6 100644 (file)
@@ -538,7 +538,13 @@ FcDirCacheMapFd (int fd, struct stat *fd_stat, struct stat *dir_stat)
        return NULL;
     cache = FcCacheFindByStat (fd_stat);
     if (cache)
-       return cache;
+    {
+       if (FcCacheTimeValid (cache, dir_stat))
+           return cache;
+       FcDirCacheUnload (cache);
+       cache = NULL;
+    }
+
     /*
      * Lage cache files are mmap'ed, smaller cache files are read. This
      * balances the system cost of mmap against per-process memory usage.