diff --git a/src/tools/acountry.c b/src/tools/acountry.c index 924fab47..85419be4 100644 --- a/src/tools/acountry.c +++ b/src/tools/acountry.c @@ -229,6 +229,8 @@ static void wait_ares(ares_channel channel) if (nfds == 0) break; tvp = ares_timeout(channel, NULL, &tv); + if (tvp == NULL) + break; nfds = select(nfds, &read_fds, &write_fds, NULL, tvp); if (nfds < 0) continue; diff --git a/src/tools/adig.c b/src/tools/adig.c index 28d55ac3..b867be6a 100644 --- a/src/tools/adig.c +++ b/src/tools/adig.c @@ -375,6 +375,8 @@ int main(int argc, char **argv) if (nfds == 0) break; tvp = ares_timeout(channel, NULL, &tv); + if (tvp == NULL) + break; count = select(nfds, &read_fds, &write_fds, NULL, tvp); if (count < 0 && (status = SOCKERRNO) != EINVAL) { diff --git a/src/tools/ahost.c b/src/tools/ahost.c index f8a39eb4..2924e5d5 100644 --- a/src/tools/ahost.c +++ b/src/tools/ahost.c @@ -167,6 +167,8 @@ int main(int argc, char **argv) if (nfds == 0) break; tvp = ares_timeout(channel, NULL, &tv); + if (tvp == NULL) + break; res = select(nfds, &read_fds, &write_fds, NULL, tvp); if (-1 == res) break;