]> git.wh0rd.org Git - fontconfig.git/commitdiff
Fix attempt to close -1. Don't unboundedly grow bad caches (reported by
authorPatrick Lam <plam@MIT.EDU>
Thu, 9 Feb 2006 16:19:42 +0000 (16:19 +0000)
committerPatrick Lam <plam@MIT.EDU>
Thu, 9 Feb 2006 16:19:42 +0000 (16:19 +0000)
    fcrozat).

ChangeLog
src/fccache.c

index df5b0ae9f2273aae0a6a96969769be359df31b46..6abd791aa24d95402f82cc62ba663285854686a4 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2006-02-09  Patrick Lam  <plam@mit.edu>
+       * src/fccache.c (FcDirCacheValid, FcDirCacheWrite):
+
+       Fix attempt to close -1.
+       Don't unboundedly grow bad caches (reported by fcrozat).
+
 2006-02-09  Patrick Lam  <plam@mit.edu>
        * src/fccharset.c (FcCharSetNeededBytes, FcCharSetSerialize, 
                           FcCharSetGetLeaf):
index 90d08942152df91c06e84054e244aca53b9c415b..69b08cb1b6a8182db20c5bcfcb42e3c4f26d9711 100644 (file)
@@ -726,7 +726,7 @@ FcDirCacheValid (const FcChar8 *dir)
     fd = FcDirCacheOpen (dir);
 
     if (fd < 0)
-       goto bail;
+       return FcFalse;
     if (fstat (fd, &file_stat) < 0)
        goto bail;
 
@@ -1239,13 +1239,15 @@ FcDirCacheWrite (FcFontSet *set, FcStrSet *dirs, const FcChar8 *dir)
        if(!FcCacheReadString (fd, name_buf, sizeof (name_buf)) || !strlen(name_buf))
        {
            close (fd);
-           break;
+           continue;
        }
        close (fd);
 
        if (strcmp (name_buf, cache_file) != 0)
            continue;
-    } while (0);
+
+       break;
+    } while (1);
 
     current_dir_block = FcDirCacheProduce (set, &metadata);