Destroy the global cache file if it's terminally broken. (reported by Mike

Fabian)
This commit is contained in:
Patrick Lam 2005-10-21 20:24:30 +00:00
parent 2fa3f27e68
commit e58b50e88c
2 changed files with 21 additions and 4 deletions

View File

@ -1,9 +1,16 @@
2005-10-21 Patrick Lam <plam@mit.edu>
* src/fccache.c (FcGlobalCacheLoad):
Destroy the global cache file if it's terminally broken. (reported by
Mike Fabian)
2005-10-21 Patrick Lam <plam@mit.edu> 2005-10-21 Patrick Lam <plam@mit.edu>
* fc-list/fc-list.c (main): * fc-list/fc-list.c (main):
* src/fcname.c (FcNameUnparse, FcNameUnparseEscaped): * src/fcname.c (FcNameUnparse, FcNameUnparseEscaped):
* fontconfig/fontconfig.h: * fontconfig/fontconfig.h:
Prevent fc-list from escaping strings when printing them. Prevent fc-list from escaping strings when printing them (reported by
Matthias Clasen).
2005-10-20 Marcus Meissner <meissner@suse.de> 2005-10-20 Marcus Meissner <meissner@suse.de>
reviewed by: plam reviewed by: plam

View File

@ -172,13 +172,13 @@ FcGlobalCacheLoad (FcGlobalCache *cache,
current_arch_start = FcCacheSkipToArch(cache->fd, current_arch_start = FcCacheSkipToArch(cache->fd,
current_arch_machine_name); current_arch_machine_name);
if (current_arch_start < 0) if (current_arch_start < 0)
goto bail0; goto bail_and_destroy;
lseek (cache->fd, current_arch_start, SEEK_SET); lseek (cache->fd, current_arch_start, SEEK_SET);
FcCacheReadString (cache->fd, candidate_arch_machine_name, FcCacheReadString (cache->fd, candidate_arch_machine_name,
sizeof (candidate_arch_machine_name)); sizeof (candidate_arch_machine_name));
if (strlen(candidate_arch_machine_name) == 0) if (strlen(candidate_arch_machine_name) == 0)
goto bail0; goto bail_and_destroy;
while (1) while (1)
{ {
@ -224,10 +224,20 @@ FcGlobalCacheLoad (FcGlobalCache *cache,
free (d); free (d);
} }
cache->dirs = 0; cache->dirs = 0;
bail0:
close (cache->fd); close (cache->fd);
cache->fd = -1; cache->fd = -1;
return; return;
bail_and_destroy:
close (cache->fd);
cache->fd = -1;
if (stat ((char *) cache_file, &cache_stat) == 0)
unlink ((char *)cache_file);
return;
} }
FcBool FcBool