]> git.ipfire.org Git - thirdparty/iw.git/commitdiff
fix bug in iftype_name()
authorJohannes Berg <johannes.berg@intel.com>
Tue, 6 Nov 2012 10:29:13 +0000 (11:29 +0100)
committerJohannes Berg <johannes.berg@intel.com>
Tue, 6 Nov 2012 10:29:13 +0000 (11:29 +0100)
If the kernel has been updated, and iw hasn't
but was recompiled, the function can return
NULL which isn't desirable. Fix it.

util.c

diff --git a/util.c b/util.c
index 869e0d67e2c95df42a2a4613ea805ba01b801131..2983e32eb97268de1fa3858e80a25ba9a992de49 100644 (file)
--- a/util.c
+++ b/util.c
@@ -139,7 +139,7 @@ static char modebuf[100];
 
 const char *iftype_name(enum nl80211_iftype iftype)
 {
-       if (iftype <= NL80211_IFTYPE_MAX)
+       if (iftype <= NL80211_IFTYPE_MAX && ifmodes[iftype])
                return ifmodes[iftype];
        sprintf(modebuf, "Unknown mode (%d)", iftype);
        return modebuf;