From 48c0f703f67839ebe66bba53e7d88e24ba33661a Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Mon, 18 Jan 2016 13:04:48 +0100 Subject: [PATCH] ahost: check the select() return code Fixes CID 137189, pointed out by Coverity --- ahost.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ahost.c b/ahost.c index 1b88d18c..9a55074f 100644 --- a/ahost.c +++ b/ahost.c @@ -142,13 +142,16 @@ int main(int argc, char **argv) /* Wait for all queries to complete. */ for (;;) { + int res; FD_ZERO(&read_fds); FD_ZERO(&write_fds); nfds = ares_fds(channel, &read_fds, &write_fds); if (nfds == 0) break; tvp = ares_timeout(channel, NULL, &tv); - select(nfds, &read_fds, &write_fds, NULL, tvp); + res = select(nfds, &read_fds, &write_fds, NULL, tvp); + if (-1 == res) + break; ares_process(channel, &read_fds, &write_fds); }