]> git.wh0rd.org Git - fontconfig.git/commitdiff
Initialize fontconfig library in fc-cat to avoid segfault.
authorPatrick Lam <plam@MIT.EDU>
Tue, 21 Feb 2006 14:12:41 +0000 (14:12 +0000)
committerPatrick Lam <plam@MIT.EDU>
Tue, 21 Feb 2006 14:12:41 +0000 (14:12 +0000)
reviewed by: plam

ChangeLog
fc-cat/fc-cat.c

index 737db03e887ead14e369f88920646f16c46a92a2..ecce9dee2b7758879cf2df76db631e582cce757f 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2006-02-21  Mike Fabian  <mfabian@suse.de>
+       reviewed by: plam
+       
+       * fc-cat/fc-cat.c (main):
+
+       Initialize fontconfig library in fc-cat to avoid segfault.
+
 2006-02-18  Patrick Lam  <plam@mit.edu>
        * fc-cache/fc-cache.c (scanDirs):
        * src/fccache.c (FcCacheReadDirs):
index f466e3ecbc62f3af09f1dd8feef1b698d5e44391..0bcc4854344a8fa77fed085fc38473565ac8b376 100644 (file)
@@ -396,6 +396,7 @@ main (int argc, char **argv)
     FcFontSet  *fs = FcFontSetCreate();
     FcStrSet    *dirs = FcStrSetCreate();
     char       *name_buf;
+    FcConfig   *config;
 
 #if HAVE_GETOPT_LONG
     while ((c = getopt_long (argc, argv, "fsVv?", longopts, NULL)) != -1)
@@ -417,6 +418,14 @@ main (int argc, char **argv)
     i = 1;
 #endif
 
+    config = FcInitLoadConfig ();
+    if (!config)
+    {
+       fprintf (stderr, "%s: Can't init font config library\n", argv[0]);
+       return 1;
+    }
+    FcConfigSetCurrent (config);
+    
     if (i >= argc)
         usage (argv[0]);
 
@@ -425,7 +434,7 @@ main (int argc, char **argv)
         char * dummy_name = (char *)FcStrPlus ((FcChar8 *)argv[i], 
                                                (FcChar8 *)"/dummy");
         if (!FcDirScanConfig (fs, dirs, 0, 0, 
-                              (const FcChar8 *)argv[i], FcFalse, 0))
+                              (const FcChar8 *)argv[i], FcFalse, config))
             fprintf (stderr, "couldn't load font dir %s\n", argv[i]);
         else
         {