[package] iwinfo: fix segmentation fault when doing two consecutive scans through...
authorJo-Philipp Wich <jow@openwrt.org>
Thu, 2 Feb 2012 14:06:16 +0000 (14:06 +0000)
committerJo-Philipp Wich <jow@openwrt.org>
Thu, 2 Feb 2012 14:06:16 +0000 (14:06 +0000)
Based on patch by Christian Kapeller <christian.kapeller@cmotion.eu> with one minor whitespace change
and updated package version.

SVN-Revision: 29992

package/iwinfo/Makefile
package/iwinfo/src/iwinfo_nl80211.c

index dae747015486beef09ff6272e22380137087e566..4f6bc1d363d0e0e48a3d5f3cecf70ea46a02cf5e 100644 (file)
@@ -7,7 +7,7 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=libiwinfo
-PKG_RELEASE:=23
+PKG_RELEASE:=24
 
 PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)
 PKG_CONFIG_DEPENDS := \
index 4f3390fdbbbb46256fe7c2bc48e86bd2dda080d6..e8cfb902f04c5ad20166bbe8b3037b8b2c1f8d01 100644 (file)
@@ -387,10 +387,13 @@ static char * nl80211_wpactl_info(const char *ifname, const char *cmd,
                goto out;
 
 
-       send(sock, "ATTACH", 6, 0);
+       if (event)
+       {
+               send(sock, "ATTACH", 6, 0);
 
-       if (nl80211_wpactl_recv(sock, buffer, sizeof(buffer)) <= 0)
-               goto out;
+               if (nl80211_wpactl_recv(sock, buffer, sizeof(buffer)) <= 0)
+                       goto out;
+       }
 
 
        send(sock, cmd, strlen(cmd), 0);
@@ -405,7 +408,7 @@ static char * nl80211_wpactl_info(const char *ifname, const char *cmd,
                        break;
                }
 
-               if ((!event && buffer[0] != '<') || strstr(buffer, event))
+               if ((!event && buffer[0] != '<') || (event && strstr(buffer, event)))
                        break;
        }