summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@sun.com>2008-12-18 21:22:31 -0800
committerAlan Coopersmith <alan.coopersmith@sun.com>2008-12-18 21:36:20 -0800
commit377584bb71ccb2cc380c3a8f71f0acd7e755ad33 (patch)
tree1af93feae44c2257cb0b5a8dfe39d10be1357bf4
parent9ad7f24fafe876851b89190732034da6fb640788 (diff)
Always scan catalogue dirs at startup, even if their mtime < 0
Works around bug in VMWare that caused the Solaris kernel to fail to read the time-of-day chip on boot, and start with a time < 0 (i.e. back to the 1960's) - when the system was then installed from this mode, Xorg wouldn't start after reboot, since the mtime would be < 0 and the catalogue dir was then skipped as not changed since reading at the 0 initially set in the cat->mtime. Fixes OpenSolaris bug #4780 <http://defect.opensolaris.org/bz/show_bug.cgi?id=4780>
-rw-r--r--src/fontfile/catalogue.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/fontfile/catalogue.c b/src/fontfile/catalogue.c
index c0d90f8..d494236 100644
--- a/src/fontfile/catalogue.c
+++ b/src/fontfile/catalogue.c
@@ -123,8 +123,10 @@ CatalogueUnrefFPEs (FontPathElementPtr fpe)
cat->fpeCount = 0;
}
+/* Rescan catalogue directory if modified timestamp has changed or
+ * the forceScan argument says to do it anyway (like on first load). */
static int
-CatalogueRescan (FontPathElementPtr fpe)
+CatalogueRescan (FontPathElementPtr fpe, Bool forceScan)
{
CataloguePtr cat = fpe->private;
char link[MAXFONTFILENAMELEN];
@@ -142,7 +144,7 @@ CatalogueRescan (FontPathElementPtr fpe)
if (stat(path, &statbuf) < 0 || !S_ISDIR(statbuf.st_mode))
return BadFontPath;
- if (statbuf.st_mtime <= cat->mtime)
+ if ((forceScan == FALSE) && (statbuf.st_mtime <= cat->mtime))
return Successful;
dir = opendir(path);
@@ -243,7 +245,7 @@ CatalogueInitFPE (FontPathElementPtr fpe)
cat->fpeList = NULL;
cat->mtime = 0;
- return CatalogueRescan (fpe);
+ return CatalogueRescan (fpe, TRUE);
}
static int
@@ -287,7 +289,7 @@ CatalogueOpenFont (pointer client, FontPathElementPtr fpe, Mask flags,
FontDirectoryPtr dir;
int i, status;
- CatalogueRescan (fpe);
+ CatalogueRescan (fpe, FALSE);
for (i = 0; i < cat->fpeCount; i++)
{
@@ -321,7 +323,7 @@ CatalogueListFonts (pointer client, FontPathElementPtr fpe, char *pat,
FontDirectoryPtr dir;
int i;
- CatalogueRescan (fpe);
+ CatalogueRescan (fpe, FALSE);
for (i = 0; i < cat->fpeCount; i++)
{
@@ -352,7 +354,7 @@ CatalogueStartListFonts(pointer client, FontPathElementPtr fpe,
LFWIDataPtr data;
int ret, i, j;
- CatalogueRescan (fpe);
+ CatalogueRescan (fpe, FALSE);
data = (LFWIDataPtr) xalloc (sizeof *data +
sizeof data->privates[0] * cat->fpeCount);