From c74bfb53392ea3575253e1f37dec16bee1b1fc66 Mon Sep 17 00:00:00 2001 From: Willem Toorop Date: Wed, 15 Jun 2016 11:04:11 +0200 Subject: [PATCH] Pass NULL to select when timeout is infinite --- src/test/getdns_query.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/test/getdns_query.c b/src/test/getdns_query.c index bce8294d..9fd025d6 100644 --- a/src/test/getdns_query.c +++ b/src/test/getdns_query.c @@ -204,11 +204,12 @@ void my_eventloop_run_once(getdns_eventloop *loop, int blocking) if (! blocking || now > timeout) { tv.tv_sec = 0; tv.tv_usec = 0; - } else { + } else if (timeout != (uint64_t)-1) { tv.tv_sec = (timeout - now) / 1000000; tv.tv_usec = (timeout - now) % 1000000; } - if (select(max_fd + 1, &readfds, &writefds, NULL, &tv) < 0) { + if (select(max_fd + 1, &readfds, &writefds, NULL, + (timeout == ((uint64_t)-1) ? NULL : &tv)) < 0) { perror("select() failed"); exit(EXIT_FAILURE); }