]> git.wh0rd.org - fontconfig.git/commitdiff
Don't bail if fontconfig can't remove a dir cache file. Skip the ID of a
authorPatrick Lam <plam@MIT.EDU>
Thu, 16 Feb 2006 07:12:04 +0000 (07:12 +0000)
committerPatrick Lam <plam@MIT.EDU>
Thu, 16 Feb 2006 07:12:04 +0000 (07:12 +0000)
    cache file when copying. Eliminate 'source file too small' bug in
    FcDirCacheWrite.

ChangeLog
fc-cache/fc-cache.c
src/fccache.c

index 6a072a01acb6538e512a85b65e6f18460821c57b..4e7b25d2183efa8d842e31f418e46a9d45270209 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -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):
 
 
        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):
index c4cca3284a65115995177b2aa6f4e04cc509fa7e..fb487d5222601a1f24326ba51b87ba9c2c39bf61 100644 (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)
        {
index 7001ced5c2d85acc1249b4dd59295bed88ccb8ca..fa7051628cef34d27d2455a6d42daea60fcf8753 100644 (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);
     }