service: network_created is set only for hidden services
authorTomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
Fri, 18 Nov 2011 13:08:52 +0000 (15:08 +0200)
committerSamuel Ortiz <sameo@linux.intel.com>
Fri, 18 Nov 2011 18:28:02 +0000 (19:28 +0100)
Fixes BMC#23976

src/service.c

index 30bf2fb..58b921d 100644 (file)
@@ -4759,6 +4759,7 @@ int __connman_service_create_and_connect(DBusMessage *msg)
        DBusMessageIter iter, array;
        const char *mode = "managed", *security = "none", *group_security;
        const char *type = NULL, *ssid = NULL, *passphrase = NULL;
+       connman_bool_t network_created = FALSE;
        unsigned int ssid_len = 0;
        const char *ident;
        char *name, *group;
@@ -4843,16 +4844,17 @@ int __connman_service_create_and_connect(DBusMessage *msg)
 
        service = lookup_by_identifier(name);
 
-       if (service != NULL)
-               goto done;
+       if (service == NULL) {
+               network = create_hidden_wifi(device, ssid,
+                                               mode, security, group);
+               if (network != NULL)
+                       connman_network_set_group(network, group);
 
-       network = create_hidden_wifi(device, ssid, mode, security, group);
-       if (network != NULL)
-               connman_network_set_group(network, group);
+               service = lookup_by_identifier(name);
 
-       service = lookup_by_identifier(name);
+               network_created = TRUE;
+       }
 
-done:
        g_free(name);
        g_free(group);
 
@@ -4861,7 +4863,7 @@ done:
                goto failed;
        }
 
-       service->network_created = TRUE;
+       service->network_created = network_created;
 
        if (is_connected(service) == TRUE) {
                err = -EISCONN;