changeset 20942:d8169b055abe

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.
author Aki Tuomi <aki.tuomi@dovecot.fi>
date Mon, 24 Oct 2016 10:08:42 +0300
parents 868cf176e7ff
children 5d1efb601d6c
files src/lib/ioloop.c
diffstat 1 files changed, 2 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/lib/ioloop.c	Sat Oct 22 22:45:48 2016 +0300
+++ b/src/lib/ioloop.c	Mon Oct 24 10:08:42 2016 +0300
@@ -422,6 +422,8 @@
 		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);