if (cache)
return cache;
/*
- * For small cache files, just read them into memory
+ * Lage cache files are mmap'ed, smaller cache files are read. This
+ * balances the system cost of mmap against per-process memory usage.
*/
if (fd_stat->st_size >= FC_CACHE_MIN_MMAP)
{
if (cache->magic != FC_CACHE_MAGIC_MMAP ||
cache->version < FC_CACHE_CONTENT_VERSION ||
cache->size != fd_stat->st_size ||
- !FcCacheInsert (cache, fd_stat) ||
- !FcCacheTimeValid (cache, dir_stat))
+ !FcCacheTimeValid (cache, dir_stat) ||
+ !FcCacheInsert (cache, fd_stat))
{
if (allocated)
free (cache);
parent = FcStrDirname (dir);
if (!parent)
return FcFalse;
- if (access ((char *) parent, W_OK|X_OK) == 0)
+ if (access ((char *) parent, F_OK) == 0)
ret = mkdir ((char *) dir, 0777) == 0;
else if (access ((char *) parent, F_OK) == -1)
ret = FcMakeDirectory (parent) && (mkdir ((char *) dir, 0777) == 0);
if (!list)
return FcFalse;
while ((test_dir = FcStrListNext (list))) {
- if (access ((char *) test_dir, W_OK|X_OK) == 0)
+ if (access ((char *) test_dir, W_OK) == 0)
{
cache_dir = test_dir;
break;