From: Henri Bragge Date: Fri, 1 Apr 2011 08:41:38 +0000 (+0300) Subject: config: Fix service configuration update X-Git-Tag: accepted/2.0alpha-wayland/20121110.002834~1582 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a667e05447dc2276a4e359a41a1604e20da17689;p=profile%2Fivi%2Fconnman.git config: Fix service configuration update Service config should not be replaced after update (the existing struct shall be reused). --- 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);