Fix a bug in wifi_essid().

When an invalid interface name is passed to wifi_essid() it does not
close opened sockets.
This commit is contained in:
Aaron Marcher 2018-01-06 23:37:09 +01:00
parent 47d0073bfd
commit fa62e8199e
No known key found for this signature in database
GPG Key ID: 74B048E5C2474F9A
1 changed files with 1 additions and 0 deletions

View File

@ -77,6 +77,7 @@ wifi_essid(const char *iface)
wreq.u.essid.pointer = id; wreq.u.essid.pointer = id;
if (ioctl(sockfd,SIOCGIWESSID, &wreq) == -1) { if (ioctl(sockfd,SIOCGIWESSID, &wreq) == -1) {
warn("Failed to get ESSID for interface %s", iface); warn("Failed to get ESSID for interface %s", iface);
close(sockfd);
return NULL; return NULL;
} }