summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Lam <plam@MIT.EDU>2006-02-07 02:22:50 +0000
committerPatrick Lam <plam@MIT.EDU>2006-02-07 02:22:50 +0000
commit8b413bb62c6743db10e7d210fb7924c9502fd60e (patch)
tree75a5ff955335700ed6c12e2938e8a3e0cb5ecbb7
parent660acf8f2278df9276c9a1bff3533e9a74fd8c6b (diff)
Takashi Iwai <tiwai@suse.de>
Don't loop infinitely on recursive symlinks (client-side).
-rw-r--r--ChangeLog7
-rw-r--r--src/fccache.c21
2 files changed, 22 insertions, 6 deletions
diff --git a/ChangeLog b/ChangeLog
index 5bb6832..8378d5d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2006-02-06 Patrick Lam <plam@mit.edu>
+ Takashi Iwai <tiwai@suse.de>
+
+ * src/fccache.c (FcCacheReadDirs, FcCacheRead):
+
+ Don't loop infinitely on recursive symlinks (client-side).
+
2006-02-06 Takashi Iwai <tiwai@suse.de>
reviewed by: plam
* fc-cache/fc-cache.c (scanDirs, main):
diff --git a/src/fccache.c b/src/fccache.c
index e836474..f2a41d4 100644
--- a/src/fccache.c
+++ b/src/fccache.c
@@ -863,7 +863,7 @@ FcDirCacheUnlink (const FcChar8 *dir, FcConfig *config)
static int
FcCacheReadDirs (FcConfig * config, FcGlobalCache * cache,
- FcStrList *list, FcFontSet * set)
+ FcStrList *list, FcFontSet * set, FcStrSet *processed_dirs)
{
int ret = 0;
FcChar8 *dir;
@@ -887,9 +887,9 @@ FcCacheReadDirs (FcConfig * config, FcGlobalCache * cache,
name = FcConfigNormalizeFontDir (config, dir);
if (name)
{
- if ((d = FcGlobalCacheDirFind (cache, (const char *)name)) != NULL &&
- d->state == FcGCDirUpdated)
+ if (FcStrSetMember (processed_dirs, dir))
continue;
+ FcStrSetAdd (processed_dirs, dir);
}
subdirs = FcStrSetCreate ();
@@ -955,7 +955,7 @@ FcCacheReadDirs (FcConfig * config, FcGlobalCache * cache,
ret++;
continue;
}
- ret += FcCacheReadDirs (config, cache, sublist, set);
+ ret += FcCacheReadDirs (config, cache, sublist, set, processed_dirs);
}
FcStrListDone (list);
return ret;
@@ -964,15 +964,24 @@ FcCacheReadDirs (FcConfig * config, FcGlobalCache * cache,
FcFontSet *
FcCacheRead (FcConfig *config, FcGlobalCache * cache)
{
- FcFontSet * s = FcFontSetCreate();
+ FcFontSet *s = FcFontSetCreate();
+ FcStrSet *processed_dirs;
+
if (!s)
return 0;
- if (FcCacheReadDirs (config, cache, FcConfigGetConfigDirs (config), s))
+ processed_dirs = FcStrSetCreate();
+ if (!processed_dirs)
goto bail;
+ if (FcCacheReadDirs (config, cache, FcConfigGetConfigDirs (config), s, processed_dirs))
+ goto bail1;
+
+ FcStrSetDestroy (processed_dirs);
return s;
+ bail1:
+ FcStrSetDestroy (processed_dirs);
bail:
FcFontSetDestroy (s);
return 0;