summaryrefslogtreecommitdiffstats
path: root/package/network/utils/iwinfo
diff options
context:
space:
mode:
authorjow <jow@3c298f89-4303-0410-b956-a3cf2f4a3e73>2013-02-03 12:03:24 +0000
committerjow <jow@3c298f89-4303-0410-b956-a3cf2f4a3e73>2013-02-03 12:03:24 +0000
commit7a44ed060819b16672c84113f6b95f23a92a2bab (patch)
treedb5e4e189a77d1b5f62bbc103c19089f209ad08b /package/network/utils/iwinfo
parentb8b1ad3912846a92d2ef698deb5f105fa6008271 (diff)
libiwinfo: reset ioctl_socket fd in iwinfo_close(), fixes random failures with multiple cycles of iwinfo_finish() / iwinfo_backend()
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@35471 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'package/network/utils/iwinfo')
-rw-r--r--package/network/utils/iwinfo/Makefile4
-rw-r--r--package/network/utils/iwinfo/src/iwinfo_utils.c12
2 files changed, 9 insertions, 7 deletions
diff --git a/package/network/utils/iwinfo/Makefile b/package/network/utils/iwinfo/Makefile
index 479dcb5f5..f8a92dac4 100644
--- a/package/network/utils/iwinfo/Makefile
+++ b/package/network/utils/iwinfo/Makefile
@@ -1,5 +1,5 @@
#
-# Copyright (C) 2010-2012 Jo-Philipp Wich <xm@subsignal.org>
+# Copyright (C) 2010-2013 Jo-Philipp Wich <xm@subsignal.org>
#
# This is free software, licensed under the GPL 2 license.
#
@@ -7,7 +7,7 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=libiwinfo
-PKG_RELEASE:=38
+PKG_RELEASE:=39
PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)
PKG_CONFIG_DEPENDS := \
diff --git a/package/network/utils/iwinfo/src/iwinfo_utils.c b/package/network/utils/iwinfo/src/iwinfo_utils.c
index 164e51f84..6616f1489 100644
--- a/package/network/utils/iwinfo/src/iwinfo_utils.c
+++ b/package/network/utils/iwinfo/src/iwinfo_utils.c
@@ -28,7 +28,7 @@ static int ioctl_socket = -1;
static int iwinfo_ioctl_socket(void)
{
/* Prepare socket */
- if( ioctl_socket == -1 )
+ if (ioctl_socket == -1)
{
ioctl_socket = socket(AF_INET, SOCK_DGRAM, 0);
fcntl(ioctl_socket, F_SETFD, fcntl(ioctl_socket, F_GETFD) | FD_CLOEXEC);
@@ -82,7 +82,7 @@ int iwinfo_ifup(const char *ifname)
strncpy(ifr.ifr_name, ifname, IFNAMSIZ);
- if( iwinfo_ioctl(SIOCGIFFLAGS, &ifr) )
+ if (iwinfo_ioctl(SIOCGIFFLAGS, &ifr))
return 0;
ifr.ifr_flags |= (IFF_UP | IFF_RUNNING);
@@ -96,7 +96,7 @@ int iwinfo_ifdown(const char *ifname)
strncpy(ifr.ifr_name, ifname, IFNAMSIZ);
- if( iwinfo_ioctl(SIOCGIFFLAGS, &ifr) )
+ if (iwinfo_ioctl(SIOCGIFFLAGS, &ifr))
return 0;
ifr.ifr_flags &= ~(IFF_UP | IFF_RUNNING);
@@ -110,7 +110,7 @@ int iwinfo_ifmac(const char *ifname)
strncpy(ifr.ifr_name, ifname, IFNAMSIZ);
- if( iwinfo_ioctl(SIOCGIFHWADDR, &ifr) )
+ if (iwinfo_ioctl(SIOCGIFHWADDR, &ifr))
return 0;
ifr.ifr_hwaddr.sa_data[1]++;
@@ -121,8 +121,10 @@ int iwinfo_ifmac(const char *ifname)
void iwinfo_close(void)
{
- if( ioctl_socket > -1 )
+ if (ioctl_socket > -1)
close(ioctl_socket);
+
+ ioctl_socket = -1;
}
struct iwinfo_hardware_entry * iwinfo_hardware(struct iwinfo_hardware_id *id)