From c3b79ead2ef3df23a4f24cbd0b71ff1792b70655 Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Mon, 27 Sep 2010 13:59:51 +0000 Subject: [libiwinfo] fix crash in iwinfo cli when operating on monitor interfaces --- contrib/package/iwinfo/src/iwinfo.lua | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'contrib') diff --git a/contrib/package/iwinfo/src/iwinfo.lua b/contrib/package/iwinfo/src/iwinfo.lua index bbd2ff750..caa2816fe 100755 --- a/contrib/package/iwinfo/src/iwinfo.lua +++ b/contrib/package/iwinfo/src/iwinfo.lua @@ -24,12 +24,16 @@ end function print_info(api, dev) local iw = iwinfo[api] + local enc = iw.encryption(dev) - printf("%-9s Type: %s ESSID: \"%s\"", dev, api, iw.ssid(dev)) - printf(" Access Point: %s", iw.bssid(dev)) + printf("%-9s Type: %s ESSID: \"%s\"", + dev, api, s(iw.ssid(dev))) + + printf(" Access Point: %s", + s(iw.bssid(dev))) printf(" Mode: %s Channel: %d (%.3f GHz)", - iw.mode(dev), iw.channel(dev), n(iw.frequency(dev)) / 1000) + iw.mode(dev), n(iw.channel(dev)), n(iw.frequency(dev)) / 1000) printf(" Tx-Power: %s dBm Link Quality: %s/%s", s(iw.txpower(dev)), s(iw.quality(dev)), s(iw.quality_max(dev))) @@ -41,7 +45,7 @@ function print_info(api, dev) n(iw.bitrate(dev)) / 1000) printf(" Encryption: %s", - iw.encryption(dev).description) + s(enc and enc.description)) print("") end @@ -84,7 +88,7 @@ function print_txpwrlist(api, dev) for _, pe in ipairs(pl) do printf("%s%3d dBm (%4d mW)", (cp == pe.dbm) and "*" or " ", - pe.dbm, pe.mw) + n(pe.dbm), n(pe.mw)) end else print("No TX power information available") -- cgit v1.2.3