diff options
author | Patrick Lam <plam@MIT.EDU> | 2006-02-21 14:12:41 +0000 |
---|---|---|
committer | Patrick Lam <plam@MIT.EDU> | 2006-02-21 14:12:41 +0000 |
commit | 9769b43d4a4d8fe5480b672124f764e5bac1f4c9 (patch) | |
tree | 47a47ca3711829c826f8c2143eb187c60955065e /fc-cat | |
parent | 530e66b008c0d5b972b54046a5b15e76c8e989b6 (diff) |
Initialize fontconfig library in fc-cat to avoid segfault.
reviewed by: plam
Diffstat (limited to 'fc-cat')
-rw-r--r-- | fc-cat/fc-cat.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/fc-cat/fc-cat.c b/fc-cat/fc-cat.c index f466e3ec..0bcc4854 100644 --- a/fc-cat/fc-cat.c +++ b/fc-cat/fc-cat.c @@ -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 { |