From b19476dec2a657cfb87052f013a98ccb9cfb8109 Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Thu, 29 Oct 2015 10:43:49 +0100 Subject: [PATCH] nl80211: fix possible fd leak in nl80211_hostapd_hup() Signed-off-by: Jo-Philipp Wich --- iwinfo_nl80211.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/iwinfo_nl80211.c b/iwinfo_nl80211.c index 4add5f4..a08d580 100644 --- a/iwinfo_nl80211.c +++ b/iwinfo_nl80211.c @@ -951,7 +951,7 @@ static void nl80211_hostapd_hup(const char *ifname) if (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) pid = atoi(buf); -- 2.25.1