Группа :: Система/Библиотеки
Пакет: libeasyfc
Главная Изменения Спек Патчи Sources Загрузить Gear Bugs and FR Repocop
Патч: libeasyfc-fix-config.patch
Скачать
Скачать
From 0729d8db8db8e6d237b33c454b90dbfc9337abf1 Mon Sep 17 00:00:00 2001
From: Akira TAGOH <akira@tagoh.org>
Date: Wed, 11 Sep 2019 12:16:03 +0000
Subject: [PATCH] Fix an issue that config can't be turned on when config dir
isn't available
https://bugzilla.redhat.com/show_bug.cgi?id=1750732
---
libeasyfc/ezfc-font-config.c | 38 ++++++++++++++++++++++++++++++++++++
1 file changed, 38 insertions(+)
diff --git a/libeasyfc/ezfc-font-config.c b/libeasyfc/ezfc-font-config.c
index 9c8c0a0..bf163a9 100644
--- a/libeasyfc/ezfc-font-config.c
+++ b/libeasyfc/ezfc-font-config.c
@@ -28,6 +28,7 @@
#include <string.h>
#include <unistd.h>
#include "ezfc-font-config-private.h"
+#include "ezfc-error.h"
/**
* SECTION: ezfc-font-config
@@ -256,6 +257,43 @@ ezfc_font_config_set_enable(ezfc_font_config_t *info,
break;
}
}
+ if (ll == NULL) {
+ const gchar *xdgcfgdir = g_get_user_config_dir();
+ gchar *fcconfdir = g_build_filename(xdgcfgdir, "fontconfig", "conf.d", NULL);
+
+ if (!g_file_test(fcconfdir, G_FILE_TEST_EXISTS)) {
+ g_mkdir_with_parents(fcconfdir, 0755);
+ } else {
+ if (!g_file_test(fcconfdir, G_FILE_TEST_IS_DIR)) {
+ g_set_error(error, EZFC_ERROR, EZFC_ERR_NO_CONFIG_DIR,
+ "Unable to create a config dir: %s",
+ fcconfdir);
+ retval = FALSE;
+ goto bail;
+ }
+ }
+ if (g_access(fcconfdir, W_OK) == 0) {
+ gchar *fn = g_path_get_basename(priv->name);
+ gchar *lfn = g_build_filename(fcconfdir, fn, NULL);
+
+ if (symlink(priv->name, lfn) == -1) {
+ if (error) {
+ save_errno = errno;
+ g_set_error(error, G_FILE_ERROR,
+ g_file_error_from_errno(save_errno),
+ "%s", g_strerror(save_errno));
+ }
+ } else {
+ g_free(priv->name);
+ priv->name = g_strdup(lfn);
+ priv->is_enabled = TRUE;
+ retval = TRUE;
+ }
+ g_free(fn);
+ g_free(lfn);
+ }
+ }
+ bail:
g_list_free(l);
} else {
if (g_file_test(priv->name, G_FILE_TEST_IS_SYMLINK)) {
--
2.21.0