From: Aki Tuomi Date: Mon, 24 Oct 2016 07:08:42 +0000 (+0300) Subject: lib: Ensure tv_r gets set in io_loop_get_wait_time X-Git-Tag: 2.2.26~58 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=4fd7c077a14c985e710fccdb1fabc9e4c83de761;p=thirdparty%2Fdovecot%2Fcore.git lib: Ensure tv_r gets set in io_loop_get_wait_time If this does not get reset here to 0 it can cause errors or unpredictable behaviour in select/kqueue polling, such as very long delays. --- diff --git a/src/lib/ioloop.c b/src/lib/ioloop.c index 3a948af4bb..2a12d9c7ee 100644 --- a/src/lib/ioloop.c +++ b/src/lib/ioloop.c @@ -422,6 +422,8 @@ int io_loop_get_wait_time(struct ioloop *ioloop, struct timeval *tv_r) if (gettimeofday(&tv_now, NULL) < 0) i_fatal("gettimeofday(): %m"); msecs = 0; + tv_r->tv_sec = 0; + tv_r->tv_usec = 0; } else { tv_now.tv_sec = 0; msecs = timeout_get_wait_time(timeout, tv_r, &tv_now);