]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib: Ensure tv_r gets set in io_loop_get_wait_time
authorAki Tuomi <aki.tuomi@dovecot.fi>
Mon, 24 Oct 2016 07:08:42 +0000 (10:08 +0300)
committerTimo Sirainen <timo.sirainen@dovecot.fi>
Mon, 24 Oct 2016 11:26:18 +0000 (14:26 +0300)
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.

src/lib/ioloop.c

index 3a948af4bb808dcec51b7e692e23f161afba80b9..2a12d9c7ee38be71b025e7e0f76f886adb2097ea 100644 (file)
@@ -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);