Commit 8c0d6921 authored by Patrick Lam's avatar Patrick Lam
Browse files

Deal correctly with changing FC_CACHE_MAGIC.

parent d2c01029
2006-02-16 Patrick Lam <plam@mit.edu>
* src/fccache.c (FcDirCacheHasCurrentArch):
Deal correctly with changing FC_CACHE_MAGIC.
2006-02-16 Patrick Lam <plam@mit.edu>
* fc-cache/fc-cache.c (usage, scanDirs, main):
......
......@@ -759,6 +759,7 @@ FcDirCacheHasCurrentArch (const FcChar8 *dir)
int fd;
off_t current_arch_start;
char *current_arch_machine_name;
FcCache metadata;
fd = FcDirCacheOpen (dir);
if (fd < 0)
......@@ -766,6 +767,22 @@ FcDirCacheHasCurrentArch (const FcChar8 *dir)
current_arch_machine_name = FcCacheMachineSignature();
current_arch_start = FcCacheSkipToArch(fd, current_arch_machine_name);
if (current_arch_start >= 0)
{
if (read(fd, &metadata, sizeof(FcCache)) != sizeof(FcCache))
{
close (fd);
return FcFalse;
}
if (metadata.magic != FC_CACHE_MAGIC)
{
close (fd);
return FcFalse;
}
}
close (fd);
if (current_arch_start < 0)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment