From a667e05447dc2276a4e359a41a1604e20da17689 Mon Sep 17 00:00:00 2001 From: Henri Bragge Date: Fri, 1 Apr 2011 11:41:38 +0300 Subject: [PATCH] config: Fix service configuration update Service config should not be replaced after update (the existing struct shall be reused). --- src/config.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/config.c b/src/config.c index e4dfcd9..dcef4e5 100644 --- a/src/config.c +++ b/src/config.c @@ -171,6 +171,7 @@ static int load_service(GKeyFile *keyfile, const char *group, struct connman_config_service *service; const char *ident; char *str, *hex_ssid; + gboolean service_created = FALSE; /* Strip off "service_" prefix */ ident = group + 8; @@ -188,6 +189,8 @@ static int load_service(GKeyFile *keyfile, const char *group, return -ENOMEM; service->ident = g_strdup(ident); + + service_created = TRUE; } str = g_key_file_get_string(keyfile, group, SERVICE_KEY_TYPE, NULL); @@ -297,7 +300,9 @@ static int load_service(GKeyFile *keyfile, const char *group, service->passphrase = str; } - g_hash_table_replace(config->service_table, service->ident, service); + if (service_created) + g_hash_table_insert(config->service_table, service->ident, + service); connman_info("Adding service configuration %s", service->ident); -- 2.7.4