wispr: Use the right interface index with gweb
authorTomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
Fri, 25 Nov 2011 11:03:04 +0000 (13:03 +0200)
committerSamuel Ortiz <sameo@linux.intel.com>
Mon, 28 Nov 2011 14:55:28 +0000 (15:55 +0100)
src/wispr.c

index 0e05f9d..64b9070 100644 (file)
@@ -627,6 +627,7 @@ static int wispr_portal_detect(struct connman_wispr_portal_context *wp_context)
 {
        enum connman_service_type service_type;
        char *interface = NULL;
+       int if_index;
        int err = 0;
 
        DBG("wispr/portal context %p", wp_context);
@@ -655,7 +656,11 @@ static int wispr_portal_detect(struct connman_wispr_portal_context *wp_context)
 
        DBG("interface %s", interface);
 
-       wp_context->web = g_web_new(0);
+       if_index = connman_inet_ifindex(interface);
+       if (if_index < 0)
+               return -EINVAL;
+
+       wp_context->web = g_web_new(if_index);
        if (wp_context->web == NULL) {
                err = -ENOMEM;
                goto done;