From c7490074c57da387904cecfdf60595713c7bb89e Mon Sep 17 00:00:00 2001 From: Patrick Lam Date: Thu, 9 Feb 2006 16:19:42 +0000 Subject: [PATCH] Fix attempt to close -1. Don't unboundedly grow bad caches (reported by fcrozat). --- ChangeLog | 6 ++++++ src/fccache.c | 8 +++++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index df5b0ae..6abd791 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2006-02-09 Patrick Lam + * src/fccache.c (FcDirCacheValid, FcDirCacheWrite): + + Fix attempt to close -1. + Don't unboundedly grow bad caches (reported by fcrozat). + 2006-02-09 Patrick Lam * src/fccharset.c (FcCharSetNeededBytes, FcCharSetSerialize, FcCharSetGetLeaf): diff --git a/src/fccache.c b/src/fccache.c index 90d0894..69b08cb 100644 --- a/src/fccache.c +++ b/src/fccache.c @@ -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); -- 2.39.5