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> 2006-02-13 Patrick Lam <plam@mit.edu>
* src/fcfreetype.c (FcFreeTypeQuery): * src/fcfreetype.c (FcFreeTypeQuery):
@ -324,7 +331,7 @@
Don't crash on non-existant directories in global cache. 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/fccache.c (FcGlobalCacheSave, FcDirCacheWrite):
* src/fccfg.c (FcConfigAddFontDirSubdirs, FcConfigNormalizeFontDir): * src/fccfg.c (FcConfigAddFontDirSubdirs, FcConfigNormalizeFontDir):
* src/fcdir.c (FcDirScanConfig): * src/fcdir.c (FcDirScanConfig):

View File

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

View File

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