More config.c copy and paste fixes
authorSamuel Ortiz <sameo@linux.intel.com>
Wed, 23 Dec 2009 23:55:32 +0000 (00:55 +0100)
committerMarcel Holtmann <marcel@holtmann.org>
Thu, 24 Dec 2009 03:29:01 +0000 (19:29 -0800)
In __connman_config_provision_service(), the config pointer was always set
to the last service entry found from the configuration files. This was
hiding many bugs introduced by the hexadecimal SSID changes.

src/config.c

index 6afe7fc..cd63d40 100644 (file)
@@ -68,7 +68,7 @@ static int load_service(GKeyFile *keyfile, struct connman_config *config)
 
        str = g_key_file_get_string(keyfile, "service", "Type", NULL);
        if (str != NULL) {
-               g_free(service->ssid);
+               g_free(service->type);
                service->type = str;
        }
 
@@ -91,7 +91,7 @@ static int load_service(GKeyFile *keyfile, struct connman_config *config)
 
                g_free(hex_ssid);
 
-               g_free(service->type);
+               g_free(service->ssid);
                service->ssid = ssid;
                service->ssid_len = hex_ssid_len / 2;
        }
@@ -415,11 +415,11 @@ int __connman_config_provision_service(struct connman_service *service)
                                ssid_len == config->service->ssid_len)
                        if (config->service->ssid &&
                                        memcmp(config->service->ssid, ssid,
-                                                               ssid_len) == 0)
+                                                       ssid_len) == 0) {
+                               config_service_setup(service, config->service);
                                break;
+                       }
        }
 
-       config_service_setup(service, config->service);
-
        return 0;
 }