]> git.wh0rd.org - fontconfig.git/blobdiff - fc-cache/fc-cache.c
Oops. Left debugging printf in previous commit.
[fontconfig.git] / fc-cache / fc-cache.c
index 7de952d677a617b182743a3059a77d28a1538638..b4d49885d4245aacc991a72139af65c1b462a9b0 100644 (file)
@@ -264,10 +264,11 @@ cleanCacheDirectory (FcConfig *config, FcChar8 *dir, FcBool verbose)
        fprintf (stderr, "%s: out of memory\n", dir);
        return FcFalse;
     }
-    if (access ((char *) dir, W_OK|X_OK) != 0)
+    if (access ((char *) dir, W_OK) != 0)
     {
        if (verbose)
-           printf ("%s: not cleaning unwritable cache directory\n", dir);
+           printf ("%s: not cleaning %s cache directory\n", dir,
+                   access ((char *) dir, F_OK) == 0 ? "unwritable" : "non-existent");
        FcStrFree (dir_base);
        return FcTrue;
     }
@@ -300,29 +301,31 @@ cleanCacheDirectory (FcConfig *config, FcChar8 *dir, FcBool verbose)
            ret = FcFalse;
            break;
        }
+       remove = FcFalse;
        cache = FcDirCacheLoadFile (file_name, &file_stat);
        if (!cache)
-       {
-           fprintf (stderr, "%s: invalid cache file: %s\n", dir, ent->d_name);
-           FcStrFree (file_name);
-           ret = FcFalse;
-           continue;
-       }
-       target_dir = FcCacheDir (cache);
-       remove = FcFalse;
-       if (stat ((char *) target_dir, &target_stat) < 0)
        {
            if (verbose)
-               printf ("%s: %s: missing directory: %s \n",
-                       dir, ent->d_name, target_dir);
+               printf ("%s: invalid cache file: %s\n", dir, ent->d_name);
            remove = FcTrue;
        }
-       else if (target_stat.st_mtime > file_stat.st_mtime)
+       else
        {
-           if (verbose)
-               printf ("%s: %s: cache outdated: %s\n",
-                       dir, ent->d_name, target_dir);
-           remove = FcTrue;
+           target_dir = FcCacheDir (cache);
+           if (stat ((char *) target_dir, &target_stat) < 0)
+           {
+               if (verbose)
+                   printf ("%s: %s: missing directory: %s \n",
+                           dir, ent->d_name, target_dir);
+               remove = FcTrue;
+           }
+           else if (target_stat.st_mtime > file_stat.st_mtime)
+           {
+               if (verbose)
+                   printf ("%s: %s: cache outdated: %s\n",
+                           dir, ent->d_name, target_dir);
+               remove = FcTrue;
+           }
        }
        if (remove)
        {