diff options
author | Jo-Philipp Wich <jow@openwrt.org> | 2010-10-27 12:18:56 +0000 |
---|---|---|
committer | Jo-Philipp Wich <jow@openwrt.org> | 2010-10-27 12:18:56 +0000 |
commit | 6a48025d6816ba34b473c93c938d47015d88d613 (patch) | |
tree | fb400223ac3c5da44fa83fcec53555a9bbe6e8ea | |
parent | 5e0536d61a277ad97c2476b908008f54dc76c1f5 (diff) |
libiwinfo: fix nl80211_get_channel() and nl80211_get_frequency()
-rw-r--r-- | contrib/package/iwinfo/Makefile | 2 | ||||
-rw-r--r-- | contrib/package/iwinfo/src/iwinfo_nl80211.c | 20 |
2 files changed, 12 insertions, 10 deletions
diff --git a/contrib/package/iwinfo/Makefile b/contrib/package/iwinfo/Makefile index 7cad39258..4651723f1 100644 --- a/contrib/package/iwinfo/Makefile +++ b/contrib/package/iwinfo/Makefile @@ -7,7 +7,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=libiwinfo -PKG_RELEASE:=9 +PKG_RELEASE:=10 PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME) diff --git a/contrib/package/iwinfo/src/iwinfo_nl80211.c b/contrib/package/iwinfo/src/iwinfo_nl80211.c index 5d1add968..c039221a5 100644 --- a/contrib/package/iwinfo/src/iwinfo_nl80211.c +++ b/contrib/package/iwinfo/src/iwinfo_nl80211.c @@ -426,7 +426,9 @@ static char * nl80211_phy2ifname(const char *ifname) DIR *d; struct dirent *e; - if( !strncmp(ifname, "phy", 3) ) + if( !ifname ) + return NULL; + else if( !strncmp(ifname, "phy", 3) ) phyidx = atoi(&ifname[3]); else if( !strncmp(ifname, "radio", 5) ) phyidx = atoi(&ifname[5]); @@ -604,11 +606,11 @@ int nl80211_get_channel(const char *ifname, int *buf) { char *first; - if( wext_get_channel(ifname, buf) && - NULL != (first = nl80211_phy2ifname(nl80211_ifname2phy(ifname))) ) - { + if( !wext_get_channel(ifname, buf) ) + return 0; + + else if( (first = nl80211_phy2ifname(nl80211_ifname2phy(ifname))) != NULL ) return wext_get_channel(first, buf); - } return -1; } @@ -617,11 +619,11 @@ int nl80211_get_frequency(const char *ifname, int *buf) { char *first; - if( wext_get_channel(ifname, buf) && - NULL != (first = nl80211_phy2ifname(nl80211_ifname2phy(ifname))) ) - { + if( !wext_get_frequency(ifname, buf) ) + return 0; + + else if( (first = nl80211_phy2ifname(nl80211_ifname2phy(ifname))) != NULL ) return wext_get_frequency(first, buf); - } return -1; } |