File fc-app-dir-fix-new-new.diff of Package fontconfig

diff -ru fontconfig-2.3.93.20060210.orig/src/fccfg.c fontconfig-2.3.93.20060210/src/fccfg.c
--- fontconfig-2.3.93.20060210.orig/src/fccfg.c	2006-02-07 16:04:03.000000000 +0100
+++ fontconfig-2.3.93.20060210/src/fccfg.c	2006-02-10 16:37:32.000000000 +0100
@@ -1879,9 +1876,10 @@
     return FcTrue;
 }
 
-FcBool
-FcConfigAppFontAddDir (FcConfig	    *config,
-		       const FcChar8   *dir)
+static FcBool
+FcConfigAppFontAddDirWithCheck (FcConfig	    *config,
+				const FcChar8   *dir,
+				FcStrSet *processed_dirs)
 {
     FcFontSet	*set;
     FcStrSet	*subdirs;
@@ -1915,11 +1913,17 @@
 	FcStrSetDestroy (subdirs);
 	return FcFalse;
     }
+    FcStrSetAdd (processed_dirs, dir);
     if ((sublist = FcStrListCreate (subdirs)))
     {
 	while ((subdir = FcStrListNext (sublist)))
 	{
-	    FcConfigAppFontAddDir (config, subdir);
+	    FcChar8 *name;
+	    name = FcConfigNormalizeFontDir (config, subdir);
+	    if (! name)
+		name = subdir;
+	    if (! FcStrSetMember (processed_dirs, name))
+		FcConfigAppFontAddDirWithCheck (config, name, processed_dirs);
 	}
 	FcStrListDone (sublist);
     }
@@ -1927,6 +1931,23 @@
     return FcTrue;
 }
 
+FcBool
+FcConfigAppFontAddDir (FcConfig	    *config,
+		       const FcChar8   *dir)
+{
+    FcStrSet *processed_dirs;
+    FcBool res;
+
+    processed_dirs = FcStrSetCreate ();
+    if (! processed_dirs)
+	return FcFalse;
+
+    res = FcConfigAppFontAddDirWithCheck (config, dir, processed_dirs);
+    FcStrSetDestroy (processed_dirs);
+
+    return res;
+}
+
 void
 FcConfigAppFontClear (FcConfig	    *config)
 {
diff -ru fontconfig-2.3.93.20060210.orig/src/fcdir.c fontconfig-2.3.93.20060210/src/fcdir.c
--- fontconfig-2.3.93.20060210.orig/src/fcdir.c	2006-02-10 13:06:08.000000000 +0100
+++ fontconfig-2.3.93.20060210/src/fcdir.c	2006-02-10 16:35:30.000000000 +0100
@@ -133,6 +133,8 @@
 	d_can = FcConfigNormalizeFontDir (config, dir);
     if (d_can)
 	dir = d_can;
+    else
+	FcConfigAddFontDir (config, dir);
 
     if (!force)
     {