spoon

set dwm status
git clone git://git.2f30.org/spoon
Log | Files | Refs | LICENSE

commit 0fb222e9af1375535203f10940071164dfad2d13
parent 44fc6dd75e411a57fda64db17cc060c6cd49b179
Author: lostd <lostd@2f30.org>
Date:   Wed,  2 Nov 2016 14:53:35 +0100

Don't use values for range or stats when ioctls fail

Diffstat:
Mwifi.c | 8++++++--
1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/wifi.c b/wifi.c @@ -144,8 +144,10 @@ wifiread(void *arg, char *buf, size_t len) wrq.u.data.length = sizeof(range); memset(&range, 0, sizeof(range)); ret = ioctl(fd, SIOCGIWRANGE, &wrq); - if (ret < 0) + if (ret < 0) { warnx("cannot get wifi range"); + continue; + } memset(&wrq, 0, sizeof(wrq)); strlcpy(wrq.ifr_name, ifa->ifa_name, IFNAMSIZ); wrq.u.data.pointer = &stats; @@ -153,8 +155,10 @@ wifiread(void *arg, char *buf, size_t len) wrq.u.data.flags = 1; memset(&stats, 0, sizeof(stats)); ret = ioctl(fd, SIOCGIWSTATS, &wrq); - if (ret < 0) + if (ret < 0) { warnx("cannot get wifi stats"); + continue; + } max_qual = &range.max_qual; qual = &stats.qual; DPRINTF_U(max_qual->qual);