libiwinfo: fix nl80211_get_channel() and nl80211_get_frequency()
This commit is contained in:
parent
5e0536d61a
commit
6a48025d68
2 changed files with 12 additions and 10 deletions
|
@ -7,7 +7,7 @@
|
||||||
include $(TOPDIR)/rules.mk
|
include $(TOPDIR)/rules.mk
|
||||||
|
|
||||||
PKG_NAME:=libiwinfo
|
PKG_NAME:=libiwinfo
|
||||||
PKG_RELEASE:=9
|
PKG_RELEASE:=10
|
||||||
|
|
||||||
PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)
|
PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)
|
||||||
|
|
||||||
|
|
|
@ -426,7 +426,9 @@ static char * nl80211_phy2ifname(const char *ifname)
|
||||||
DIR *d;
|
DIR *d;
|
||||||
struct dirent *e;
|
struct dirent *e;
|
||||||
|
|
||||||
if( !strncmp(ifname, "phy", 3) )
|
if( !ifname )
|
||||||
|
return NULL;
|
||||||
|
else if( !strncmp(ifname, "phy", 3) )
|
||||||
phyidx = atoi(&ifname[3]);
|
phyidx = atoi(&ifname[3]);
|
||||||
else if( !strncmp(ifname, "radio", 5) )
|
else if( !strncmp(ifname, "radio", 5) )
|
||||||
phyidx = atoi(&ifname[5]);
|
phyidx = atoi(&ifname[5]);
|
||||||
|
@ -604,11 +606,11 @@ int nl80211_get_channel(const char *ifname, int *buf)
|
||||||
{
|
{
|
||||||
char *first;
|
char *first;
|
||||||
|
|
||||||
if( wext_get_channel(ifname, buf) &&
|
if( !wext_get_channel(ifname, buf) )
|
||||||
NULL != (first = nl80211_phy2ifname(nl80211_ifname2phy(ifname))) )
|
return 0;
|
||||||
{
|
|
||||||
|
else if( (first = nl80211_phy2ifname(nl80211_ifname2phy(ifname))) != NULL )
|
||||||
return wext_get_channel(first, buf);
|
return wext_get_channel(first, buf);
|
||||||
}
|
|
||||||
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -617,11 +619,11 @@ int nl80211_get_frequency(const char *ifname, int *buf)
|
||||||
{
|
{
|
||||||
char *first;
|
char *first;
|
||||||
|
|
||||||
if( wext_get_channel(ifname, buf) &&
|
if( !wext_get_frequency(ifname, buf) )
|
||||||
NULL != (first = nl80211_phy2ifname(nl80211_ifname2phy(ifname))) )
|
return 0;
|
||||||
{
|
|
||||||
|
else if( (first = nl80211_phy2ifname(nl80211_ifname2phy(ifname))) != NULL )
|
||||||
return wext_get_frequency(first, buf);
|
return wext_get_frequency(first, buf);
|
||||||
}
|
|
||||||
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue