From 317911a1a02ee13b759042a778adf55592a7d233 Mon Sep 17 00:00:00 2001 From: Azat Khuzhin Date: Sun, 18 Feb 2024 20:39:12 +0100 Subject: [PATCH] Fix util/monotonic_prc_fallback under FreeBSD Looks like there was garbage, since evutil_configure_monotonic_time_() does not reset evutil_monotonic_timer structure, while in case of fallback it uses two fields from it: - last_time - adjust_monotonic_clock Fixes: https://github.com/libevent/libevent/issues/1495 --- evutil_time.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/evutil_time.c b/evutil_time.c index 514f2c8a..04916579 100644 --- a/evutil_time.c +++ b/evutil_time.c @@ -316,6 +316,8 @@ evutil_configure_monotonic_time_(struct evutil_monotonic_timer *base, const int fallback = flags & EV_MONOT_FALLBACK; struct timespec ts; + memset(base, 0, sizeof(*base)); + #ifdef CLOCK_MONOTONIC_COARSE if (CLOCK_MONOTONIC_COARSE < 0) { /* Technically speaking, nothing keeps CLOCK_* from being