summaryrefslogtreecommitdiff
path: root/package/network/utils/iwinfo
diff options
context:
space:
mode:
authorJo-Philipp Wich <jow@openwrt.org>2013-04-28 14:04:39 +0000
committerJo-Philipp Wich <jow@openwrt.org>2013-04-28 14:04:39 +0000
commitf1e214411d8fe78a19d4df6837f4cbc4aa136667 (patch)
treef9c102e8c7a0d60ec76d2113a0e7b21c932d58f3 /package/network/utils/iwinfo
parentad1d3f00cb8124980620a7aa4e6ce0460c2d8778 (diff)
downloadmtk-20170518-f1e214411d8fe78a19d4df6837f4cbc4aa136667.zip
mtk-20170518-f1e214411d8fe78a19d4df6837f4cbc4aa136667.tar.gz
mtk-20170518-f1e214411d8fe78a19d4df6837f4cbc4aa136667.tar.bz2
iwinfo: fix iwinfo_hardware() return value if chip id is not found
SVN-Revision: 36471
Diffstat (limited to 'package/network/utils/iwinfo')
-rw-r--r--package/network/utils/iwinfo/Makefile2
-rw-r--r--package/network/utils/iwinfo/src/iwinfo_utils.c9
2 files changed, 4 insertions, 7 deletions
diff --git a/package/network/utils/iwinfo/Makefile b/package/network/utils/iwinfo/Makefile
index 3758692..e0090e0 100644
--- a/package/network/utils/iwinfo/Makefile
+++ b/package/network/utils/iwinfo/Makefile
@@ -7,7 +7,7 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=libiwinfo
-PKG_RELEASE:=43
+PKG_RELEASE:=44
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 b6760c3..1a831f3 100644
--- a/package/network/utils/iwinfo/src/iwinfo_utils.c
+++ b/package/network/utils/iwinfo/src/iwinfo_utils.c
@@ -131,7 +131,7 @@ struct iwinfo_hardware_entry * iwinfo_hardware(struct iwinfo_hardware_id *id)
{
FILE *db;
char buf[256] = { 0 };
- static struct iwinfo_hardware_entry e;
+ static struct iwinfo_hardware_entry e, *rv = NULL;
if (!(db = fopen(IWINFO_HARDWARE_FILE, "r")))
return NULL;
@@ -161,15 +161,12 @@ struct iwinfo_hardware_entry * iwinfo_hardware(struct iwinfo_hardware_id *id)
(e.subsystem_device_id != id->subsystem_device_id))
continue;
+ rv = &e;
break;
}
fclose(db);
-
- if (e.device_name[0])
- return &e;
-
- return NULL;
+ return rv;
}
int iwinfo_hardware_id_from_mtd(struct iwinfo_hardware_id *id)