From 84ae6ef3d8bb1f3938349960f4b46208e6c62f73 Mon Sep 17 00:00:00 2001 From: Andrea Zagli Date: Sat, 8 Oct 2016 11:36:57 +0200 Subject: [PATCH] Plg. file: ignore CONFI_NAME in connection string. --- plugins/file/plgfile.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/plugins/file/plgfile.c b/plugins/file/plgfile.c index 4634fb9..1b35385 100644 --- a/plugins/file/plgfile.c +++ b/plugins/file/plgfile.c @@ -163,12 +163,35 @@ zak_confi_file_plugin_initialize (ZakConfiPluggable *pluggable, const gchar *cnc { gboolean ret; GError *error; + gchar *strconfname; + gchar *strconfnameend; + gchar *cncstringnew; ZakConfiFilePlugin *plugin = ZAK_CONFI_FILE_PLUGIN (pluggable); ZakConfiFilePluginPrivate *priv = ZAK_CONFI_FILE_PLUGIN_GET_PRIVATE (plugin); priv->cnc_string = g_strdup (cnc_string); + strconfname = g_strstr_len (priv->cnc_string, -1, ";CONFI_NAME"); + if (strconfname != NULL) + { + /* ignore CONFI_NAME parameter on connection string */ + strconfnameend = g_strstr_len (strconfname + 1, -1, ";"); + if (strconfnameend == NULL) + { + priv->cnc_string[strlen (priv->cnc_string) - strlen (strconfname)] = '\0'; + } + else + { + cncstringnew = g_strdup_printf ("%s%s", + g_strndup (priv->cnc_string, strlen (priv->cnc_string) - strlen (strconfname)), + g_strdup (strconfnameend)); + g_free (priv->cnc_string); + priv->cnc_string = g_strdup (cncstringnew); + g_free (cncstringnew); + } + } + priv->kfile = g_key_file_new (); error = NULL; if (g_key_file_load_from_file (priv->kfile, priv->cnc_string, G_KEY_FILE_KEEP_COMMENTS | G_KEY_FILE_KEEP_TRANSLATIONS, &error) -- 2.49.0