Subject: [PATCH 4/5] Re-start loop if select fails

[PATCH 4/5] Re-start loop if select fails

From: Gregor Jasny <gjasny_at_googlemail.com>
Date: Fri, 19 Sep 2014 20:51:05 +0200

Fix Coverity error CID 56882

Signed-off-by: Gregor Jasny <gjasny_at_googlemail.com>

---
 acountry.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/acountry.c b/acountry.c
index fae9f9f..1fe750c 100644
--- a/acountry.c
+++ b/acountry.c
@@ -200,7 +200,9 @@ static void wait_ares(ares_channel channel)
       if (nfds == 0)
         break;
       tvp = ares_timeout(channel, NULL, &tv);
-      select(nfds, &read_fds, &write_fds, NULL, tvp);
+      nfds = select(nfds, &read_fds, &write_fds, NULL, tvp);
+      if (nfds < 0)
+        continue;
       ares_process(channel, &read_fds, &write_fds);
     }
 }
-- 
1.8.5.2 (Apple Git-48)
Received on 2014-09-19