]> git.wh0rd.org - fontconfig.git/blobdiff - src/fccache.c
Make file_stat argument to FcDirCacheLoadFile optional.
[fontconfig.git] / src / fccache.c
index a6b532fa118c148c7eb80b49bf362941e2f79da4..c24b06184a120a6571cee4e749473fc81e47fe34 100644 (file)
@@ -493,8 +493,8 @@ FcDirCacheMapFd (int fd, struct stat *fd_stat, struct stat *dir_stat)
     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);
@@ -559,7 +559,10 @@ FcDirCacheLoadFile (const FcChar8 *cache_file, struct stat *file_stat)
 {
     int        fd;
     FcCache *cache;
+    struct stat        my_file_stat;
 
+    if (!file_stat)
+       file_stat = &my_file_stat;
     fd = FcDirCacheOpenFile (cache_file, file_stat);
     if (fd < 0)
        return NULL;
@@ -727,7 +730,7 @@ FcMakeDirectory (const FcChar8 *dir)
     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);
@@ -760,7 +763,7 @@ FcDirCacheWrite (FcCache *cache, FcConfig *config)
     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;