nl80211: fix possible fd leak in nl80211_hostapd_hup()

Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
This commit is contained in:
Jo-Philipp Wich 2015-10-29 10:43:49 +01:00
parent eeaae3d011
commit b19476dec2

View file

@ -951,7 +951,7 @@ static void nl80211_hostapd_hup(const char *ifname)
if (phy) if (phy)
{ {
snprintf(buf, sizeof(buf), "/var/run/wifi-%s.pid", phy); snprintf(buf, sizeof(buf), "/var/run/wifi-%s.pid", phy);
if ((fd = open(buf, O_RDONLY)) > 0) if ((fd = open(buf, O_RDONLY)) >= 0)
{ {
if (read(fd, buf, sizeof(buf)) > 0) if (read(fd, buf, sizeof(buf)) > 0)
pid = atoi(buf); pid = atoi(buf);