ahost: check the select() return code

Fixes CID 137189, pointed out by Coverity
pull/32/merge
Daniel Stenberg 9 years ago
parent 250e7a20cc
commit 48c0f703f6
  1. 5
      ahost.c

@ -142,13 +142,16 @@ int main(int argc, char **argv)
/* Wait for all queries to complete. */ /* Wait for all queries to complete. */
for (;;) for (;;)
{ {
int res;
FD_ZERO(&read_fds); FD_ZERO(&read_fds);
FD_ZERO(&write_fds); FD_ZERO(&write_fds);
nfds = ares_fds(channel, &read_fds, &write_fds); nfds = ares_fds(channel, &read_fds, &write_fds);
if (nfds == 0) if (nfds == 0)
break; break;
tvp = ares_timeout(channel, NULL, &tv); 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); ares_process(channel, &read_fds, &write_fds);
} }

Loading…
Cancel
Save