Fix attempt to close -1. Don't unboundedly grow bad caches (reported by

fcrozat).
This commit is contained in:
Patrick Lam 2006-02-09 16:19:42 +00:00
parent a8c425301a
commit c7490074c5
2 changed files with 11 additions and 3 deletions

View File

@ -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):

View 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);