From: Patrick Lam Date: Thu, 16 Feb 2006 07:12:04 +0000 (+0000) Subject: Don't bail if fontconfig can't remove a dir cache file. Skip the ID of a X-Git-Tag: fc-2_3_94~19 X-Git-Url: https://git.wh0rd.org/?a=commitdiff_plain;h=719f4b841f9763f2e4aa10a61cb2ffd41d9e8226;p=fontconfig.git 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. --- diff --git a/ChangeLog b/ChangeLog index 6a072a0..4e7b25d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2006-02-16 Patrick Lam + * 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 * src/fcfreetype.c (FcFreeTypeQuery): @@ -324,7 +331,7 @@ Don't crash on non-existant directories in global cache. -2006-01-26 Patirck Lam +2006-01-26 Patrick Lam * src/fccache.c (FcGlobalCacheSave, FcDirCacheWrite): * src/fccfg.c (FcConfigAddFontDirSubdirs, FcConfigNormalizeFontDir): * src/fcdir.c (FcDirScanConfig): diff --git a/fc-cache/fc-cache.c b/fc-cache/fc-cache.c index c4cca32..fb487d5 100644 --- a/fc-cache/fc-cache.c +++ b/fc-cache/fc-cache.c @@ -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) { diff --git a/src/fccache.c b/src/fccache.c index 7001ced..fa70516 100644 --- a/src/fccache.c +++ b/src/fccache.c @@ -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); }