summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog6
-rw-r--r--fc-cache/fc-cache.c18
2 files changed, 24 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index ec58f33..5bb6832 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
2006-02-06 Takashi Iwai <tiwai@suse.de>
reviewed by: plam
+ * fc-cache/fc-cache.c (scanDirs, main):
+
+ Don't loop infinitely on recursive symlinks.
+
+2006-02-06 Takashi Iwai <tiwai@suse.de>
+ reviewed by: plam
* src/fccache.c (FcGlobalCacheLoad, FcGlobalCacheReadDir,
FcGlobalCacheDirFind, FcGlobalCacheUpdate,
FcGlobalCacheSave, FcCacheReadDirs):
diff --git a/fc-cache/fc-cache.c b/fc-cache/fc-cache.c
index f93a085..c4cca32 100644
--- a/fc-cache/fc-cache.c
+++ b/fc-cache/fc-cache.c
@@ -93,6 +93,8 @@ usage (char *program)
exit (1);
}
+static FcStrSet *processed_dirs;
+
static int
nsubdirs (FcStrSet *set)
{
@@ -140,6 +142,12 @@ scanDirs (FcStrList *list, FcConfig *config, char *program, FcBool force, FcBool
continue;
}
+ if (FcStrSetMember (processed_dirs, dir))
+ {
+ if (verbose)
+ printf ("skipping, looped directory detected\n");
+ continue;
+ }
set = FcFontSetCreate ();
if (!set)
@@ -236,6 +244,7 @@ scanDirs (FcStrList *list, FcConfig *config, char *program, FcBool force, FcBool
ret++;
continue;
}
+ FcStrSetAdd (processed_dirs, dir);
ret += scanDirs (sublist, config, program, force, verbose);
}
FcStrListDone (list);
@@ -318,7 +327,16 @@ main (int argc, char **argv)
}
else
list = FcConfigGetConfigDirs (config);
+
+ if ((processed_dirs = FcStrSetCreate()) == NULL) {
+ fprintf(stderr, "Cannot malloc\n");
+ return 1;
+ }
+
ret = scanDirs (list, config, argv[0], force, verbose);
+
+ FcStrSetDestroy (processed_dirs);
+
/*
* Now we need to sleep a second (or two, to be extra sure), to make
* sure that timestamps for changes after this run of fc-cache are later