Try to open /var/cache/fontconfig/[hashed name] before fonts.cache-2 in a
directory, because /var/cache/fontconfig failures ought to be fixable, unlike fonts.cache-2 failures, which may leave you screwed. reviewed by: plam
This commit is contained in:
parent
9e07e0a77b
commit
d00c3cb5e0
|
@ -1,3 +1,12 @@
|
||||||
|
2006-02-10 Takashi Iwai <tiwai@suse.de>
|
||||||
|
reviewed by: plam
|
||||||
|
* src/fccache.c (FcDirCacheOpen):
|
||||||
|
|
||||||
|
Try to open /var/cache/fontconfig/[hashed name] before
|
||||||
|
fonts.cache-2 in a directory, because /var/cache/fontconfig
|
||||||
|
failures ought to be fixable, unlike fonts.cache-2 failures,
|
||||||
|
which may leave you screwed.
|
||||||
|
|
||||||
2006-02-10 Takashi Iwai <tiwai@suse.de>
|
2006-02-10 Takashi Iwai <tiwai@suse.de>
|
||||||
reviewed by: plam
|
reviewed by: plam
|
||||||
* src/fcmatch.c (FcFontSetMatch):
|
* src/fcmatch.c (FcFontSetMatch):
|
||||||
|
|
|
@ -1019,22 +1019,21 @@ FcDirCacheOpen (const FcChar8 *dir)
|
||||||
char name_buf[FC_MAX_FILE_LEN];
|
char name_buf[FC_MAX_FILE_LEN];
|
||||||
struct stat dir_stat;
|
struct stat dir_stat;
|
||||||
|
|
||||||
cache_file = (char *)FcStrPlus (dir, (FcChar8 *) "/" FC_DIR_CACHE_FILE);
|
if (stat ((char *)dir, &dir_stat) == -1)
|
||||||
if (!cache_file)
|
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
fd = open(cache_file, O_RDONLY | O_BINARY);
|
cache_file = (char *)FcStrPlus (dir, (FcChar8 *) "/" FC_DIR_CACHE_FILE);
|
||||||
if (fd != -1)
|
if (!cache_file)
|
||||||
return fd;
|
|
||||||
|
|
||||||
if (stat ((char *)dir, &dir_stat) == -1)
|
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
found = FcFalse;
|
found = FcFalse;
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
struct stat c;
|
struct stat c;
|
||||||
FcChar8 * name_buf_dir;
|
FcChar8 *name_buf_dir;
|
||||||
|
|
||||||
|
if (fd >= 0)
|
||||||
|
close (fd);
|
||||||
|
|
||||||
cache_hashed = FcDirCacheHashName (cache_file, collisions++);
|
cache_hashed = FcDirCacheHashName (cache_file, collisions++);
|
||||||
if (!cache_hashed)
|
if (!cache_hashed)
|
||||||
|
@ -1043,18 +1042,14 @@ FcDirCacheOpen (const FcChar8 *dir)
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fd > 0)
|
|
||||||
close (fd);
|
|
||||||
fd = open(cache_hashed, O_RDONLY | O_BINARY);
|
fd = open(cache_hashed, O_RDONLY | O_BINARY);
|
||||||
FcStrFree ((FcChar8 *)cache_hashed);
|
FcStrFree ((FcChar8 *)cache_hashed);
|
||||||
|
|
||||||
if (fd == -1)
|
if (fd == -1)
|
||||||
{
|
break;
|
||||||
FcStrFree ((FcChar8 *)cache_file);
|
if (!FcCacheReadString (fd, name_buf, sizeof (name_buf)) ||
|
||||||
return -1;
|
!strlen(name_buf))
|
||||||
}
|
break;
|
||||||
if (!FcCacheReadString (fd, name_buf, sizeof (name_buf)) || !strlen(name_buf))
|
|
||||||
goto bail;
|
|
||||||
|
|
||||||
name_buf_dir = FcStrDirname ((FcChar8 *)name_buf);
|
name_buf_dir = FcStrDirname ((FcChar8 *)name_buf);
|
||||||
if (stat ((char *)name_buf_dir, &c) == -1)
|
if (stat ((char *)name_buf_dir, &c) == -1)
|
||||||
|
@ -1065,13 +1060,16 @@ FcDirCacheOpen (const FcChar8 *dir)
|
||||||
FcStrFree (name_buf_dir);
|
FcStrFree (name_buf_dir);
|
||||||
found = (c.st_ino == dir_stat.st_ino) && (c.st_dev == dir_stat.st_dev);
|
found = (c.st_ino == dir_stat.st_ino) && (c.st_dev == dir_stat.st_dev);
|
||||||
} while (!found);
|
} while (!found);
|
||||||
|
|
||||||
|
if (!found || fd < 0)
|
||||||
|
{
|
||||||
|
if (fd >= 0)
|
||||||
|
close (fd);
|
||||||
|
fd = open(cache_file, O_RDONLY | O_BINARY);
|
||||||
|
}
|
||||||
|
|
||||||
FcStrFree ((FcChar8 *)cache_file);
|
FcStrFree ((FcChar8 *)cache_file);
|
||||||
return fd;
|
return fd;
|
||||||
|
|
||||||
bail:
|
|
||||||
FcStrFree ((FcChar8 *)cache_file);
|
|
||||||
close (fd);
|
|
||||||
return -1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* read serialized state from the cache file */
|
/* read serialized state from the cache file */
|
||||||
|
|
Loading…
Reference in New Issue