]> git.wh0rd.org Git - fontconfig.git/commitdiff
Check existence of directory cache file before attempting to unlink.
authorPatrick Lam <plam@MIT.EDU>
Fri, 14 Oct 2005 20:56:27 +0000 (20:56 +0000)
committerPatrick Lam <plam@MIT.EDU>
Fri, 14 Oct 2005 20:56:27 +0000 (20:56 +0000)
reviewed by: plam

ChangeLog
src/fccache.c

index 2ccc120bf8f2b798258746248d146ada994d97b0..bd2585e37693788c2afb0974596c9ddaf9c6d1ce 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2005-10-14  Mike Fabian  <mfabian@suse.de>
+        reviewed by: plam
+
+        * src/fccache.c (FcDirCacheUnlink):
+
+        Check existence of directory cache file before attempting to unlink.
+
 2005-10-13  Patrick Lam  <plam@mit.edu>
        * src/fccache.c (FcDirCacheUnlink):
 
index 7ccb5295013f3a946146d0af273406faca06855b..0bbfffe244b2ad6cb9ccd4c247296ee6971d87c7 100644 (file)
@@ -573,8 +573,10 @@ FcBool
 FcDirCacheUnlink (const FcChar8 *dir)
 {
     FcChar8     *cache_file = FcStrPlus (dir, (FcChar8 *) "/" FC_DIR_CACHE_FILE);
+    struct stat        cache_stat;
 
-    if (unlink ((char *)cache_file) != 0)
+    if (stat ((char *) cache_file, &cache_stat) == 0 &&
+       unlink ((char *)cache_file) != 0)
     {
        FcStrFree (cache_file);
         return FcFalse;