]> git.wh0rd.org - fontconfig.git/commitdiff
Fix addressing in the global cache file, preventing infinite loops. Get rid
authorPatrick Lam <plam@MIT.EDU>
Fri, 2 Sep 2005 06:16:49 +0000 (06:16 +0000)
committerPatrick Lam <plam@MIT.EDU>
Fri, 2 Sep 2005 06:16:49 +0000 (06:16 +0000)
    of unused variables.

src/fccache.c

index ce4f49d28907effa97d1f81e3b0c129694e147f9..fc2fcc6df15e410b3f2b5161ab86c8dd0f9816fa 100644 (file)
@@ -189,7 +189,7 @@ FcGlobalCacheLoad (FcGlobalCache    *cache,
        d->ent = 0;
        d->offset = lseek (cache->fd, 0, SEEK_CUR);
        read (cache->fd, &d->metadata, sizeof (FcCache));
-       lseek (cache->fd, d->metadata.count, SEEK_CUR);
+       lseek (cache->fd, FcCacheNextOffset (lseek(cache->fd, 0, SEEK_CUR)) + d->metadata.count, SEEK_SET);
     }
     return;
 
@@ -325,7 +325,7 @@ FcGlobalCacheSave (FcGlobalCache    *cache,
         {
             FcCacheWriteString (fd, dir->name);
             write (fd, &dir->metadata, sizeof(FcCache));
-            lseek (fd, FcCacheNextOffset (lseek(fd, 0, SEEK_END)), SEEK_SET);
+            lseek (fd, FcCacheNextOffset (lseek(fd, 0, SEEK_CUR)), SEEK_SET);
             write (fd, dir->ent, dir->metadata.count);
             free (dir->ent);
         }
@@ -477,8 +477,6 @@ static int
 FcCacheReadDirs (FcConfig * config, FcGlobalCache * cache, 
                 FcStrList *list, FcFontSet * set)
 {
-    DIR                        *d;
-    struct dirent      *e;
     int                        ret = 0;
     FcChar8            *dir;
     FcChar8            *file, *base;