summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2009-07-08 19:16:56 -0700
committerMarcel Holtmann <marcel@holtmann.org>2009-07-08 19:16:56 -0700
commit2839a2d296cac7bd832e72f1032a996bd92fee6d (patch)
treee5f8fea6cf7229ab4b5ac89ea1ce890ed6d3723b /plugins
parent88dec5fabade98174d5eed06c28e1181fc230a7a (diff)
downloadconnman-2839a2d296cac7bd832e72f1032a996bd92fee6d.tar.gz
connman-2839a2d296cac7bd832e72f1032a996bd92fee6d.tar.bz2
connman-2839a2d296cac7bd832e72f1032a996bd92fee6d.zip
Simplify the SIOCGIWRANGE handling a little bit
Diffstat (limited to 'plugins')
-rw-r--r--plugins/supplicant.c22
1 files changed, 9 insertions, 13 deletions
diff --git a/plugins/supplicant.c b/plugins/supplicant.c
index 86108c9e..945223bc 100644
--- a/plugins/supplicant.c
+++ b/plugins/supplicant.c
@@ -1495,23 +1495,23 @@ static DBusHandlerResult supplicant_filter(DBusConnection *conn,
static int supplicant_get_range(struct supplicant_task *task)
{
- int fd, ret;
struct iwreq wrq;
+ int fd, err;
fd = socket(PF_INET, SOCK_DGRAM, 0);
if (fd < 0)
- return -errno;
+ return -1;
memset(&wrq, 0, sizeof(struct iwreq));
strncpy(wrq.ifr_name, task->ifname, IFNAMSIZ);
wrq.u.data.pointer = task->range;
wrq.u.data.length = sizeof(struct iw_range);
- ret = ioctl(fd, SIOCGIWRANGE, &wrq);
+ err = ioctl(fd, SIOCGIWRANGE, &wrq);
close(fd);
- return ret;
+ return err;
}
int supplicant_start(struct connman_device *device)
@@ -1530,18 +1530,18 @@ int supplicant_start(struct connman_device *device)
if (task->ifname == NULL) {
err = -ENOMEM;
- goto err_ifname;
+ goto failed;
}
task->range = g_try_malloc0(sizeof(struct iw_range));
if (task->range == NULL) {
err = -ENOMEM;
- goto err_range;
+ goto failed;
}
err = supplicant_get_range(task);
- if (err)
- goto err_get_range;
+ if (err < 0)
+ goto failed;
task->device = connman_device_ref(device);
@@ -1553,13 +1553,9 @@ int supplicant_start(struct connman_device *device)
return create_interface(task);
-err_get_range:
+failed:
g_free(task->range);
-
-err_range:
g_free(task->ifname);
-
-err_ifname:
g_free(task);
return err;