Don't bail if fontconfig can't remove a dir cache file. Skip the ID of a

cache file when copying. Eliminate 'source file too small' bug in
    FcDirCacheWrite.
This commit is contained in:
Patrick Lam 2006-02-16 07:12:04 +00:00
parent f8a17f3298
commit 719f4b841f
3 changed files with 21 additions and 12 deletions

View File

@ -1,3 +1,10 @@
2006-02-16 Patrick Lam <plam@mit.edu>
* src/fccache.c (FcDirCacheUnlink, FcCacheCopyOld, FcDirCacheWrite):
Don't bail if fontconfig can't remove a dir cache file.
Skip the ID of a cache file when copying.
Eliminate 'source file too small' bug in FcDirCacheWrite.
2006-02-13 Patrick Lam <plam@mit.edu>
* src/fcfreetype.c (FcFreeTypeQuery):
@ -324,7 +331,7 @@
Don't crash on non-existant directories in global cache.
2006-01-26 Patirck Lam <plam@mit.edu>
2006-01-26 Patrick Lam <plam@mit.edu>
* src/fccache.c (FcGlobalCacheSave, FcDirCacheWrite):
* src/fccfg.c (FcConfigAddFontDirSubdirs, FcConfigNormalizeFontDir):
* src/fcdir.c (FcDirScanConfig):

View File

@ -172,20 +172,24 @@ scanDirs (FcStrList *list, FcConfig *config, char *program, FcBool force, FcBool
case ENOTDIR:
if (verbose)
printf ("skipping, no such directory\n");
break;
FcFontSetDestroy (set);
FcStrSetDestroy (subdirs);
continue;
case EACCES:
case EROFS:
if (verbose)
printf ("skipping, no write access\n");
/* That's ok, caches go to /var anyway. */
/* Ideally we'd do an access on the hashed_name. */
/* But we hid that behind an abstraction barrier. */
break;
default:
fprintf (stderr, "\"%s\": ", dir);
perror ("");
ret++;
FcFontSetDestroy (set);
FcStrSetDestroy (subdirs);
continue;
}
FcFontSetDestroy (set);
FcStrSetDestroy (subdirs);
continue;
}
if (stat ((char *) dir, &statb) == -1)
{

View File

@ -665,6 +665,7 @@ FcCacheCopyOld (int fd, int fd_orig, off_t start)
loc = 0;
lseek (fd, 0, SEEK_SET); lseek (fd_orig, 0, SEEK_SET);
FcCacheSkipString (fd); FcCacheSkipString (fd_orig);
do
{
int b = 8192;
@ -791,9 +792,8 @@ FcDirCacheUnlink (const FcChar8 *dir, FcConfig *config)
return FcFalse;
/* First remove normal cache file. */
if (stat ((char *) cache_file, &cache_stat) == 0 &&
unlink ((char *)cache_file) != 0)
goto bail;
if (stat ((char *) cache_file, &cache_stat) == 0)
unlink ((char *)cache_file);
/* Next remove any applicable hashed files. */
fd = -1; collisions = 0;
@ -1300,8 +1300,6 @@ FcDirCacheWrite (FcFontSet *set, FcStrSet *dirs, const FcChar8 *dir)
if (current_arch_start < 0)
{
off_t i = lseek(fd_orig, 0, SEEK_END);
if (i < strlen (FC_GLOBAL_MAGIC_COOKIE)+1)
i = strlen (FC_GLOBAL_MAGIC_COOKIE)+1;
current_arch_start = FcCacheNextOffset (i);
}