nl80211: fix possible fd leak in nl80211_hostapd_hup()
authorJo-Philipp Wich <jow@openwrt.org>
Thu, 29 Oct 2015 09:43:49 +0000 (10:43 +0100)
committerJo-Philipp Wich <jow@openwrt.org>
Thu, 29 Oct 2015 09:43:49 +0000 (10:43 +0100)
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
iwinfo_nl80211.c

index 4add5f49f8873df7aad173b3016b9066dd81732b..a08d5807edf0ae1e347098ba22c0ff179b3d9ca4 100644 (file)
@@ -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);