From 7835c371c72b42a55a451356246733e32bdbdffa Mon Sep 17 00:00:00 2001 From: Frank Lichtenheld Date: Tue, 11 Nov 2025 16:51:31 +0100 Subject: [PATCH] forward: Change context_reschedule_sec sec argument to time_t This avoids conversions at the caller sites. Since we only replace tv_sec if the new value is smaller the cast to tv_sec_t is also safe. Change-Id: Id9158f477404aac1d6b08b08e672980e5a58dc35 Signed-off-by: Frank Lichtenheld Acked-by: Arne Schwabe Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1356 Message-Id: <20251111155139.31642-1-gert@greenie.muc.de> URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg34319.html Signed-off-by: Gert Doering --- src/openvpn/forward.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/openvpn/forward.c b/src/openvpn/forward.c index 90e52d24b..f01fb4cf4 100644 --- a/src/openvpn/forward.c +++ b/src/openvpn/forward.c @@ -33,6 +33,7 @@ #include "mss.h" #include "event.h" #include "occ.h" +#include "otime.h" #include "ping.h" #include "ps.h" #include "dhcp.h" @@ -127,7 +128,7 @@ context_immediate_reschedule(struct context *c) } static inline void -context_reschedule_sec(struct context *c, int sec) +context_reschedule_sec(struct context *c, time_t sec) { if (sec < 0) { @@ -135,7 +136,7 @@ context_reschedule_sec(struct context *c, int sec) } if (sec < c->c2.timeval.tv_sec) { - c->c2.timeval.tv_sec = sec; + c->c2.timeval.tv_sec = (tv_sec_t)sec; c->c2.timeval.tv_usec = 0; } } @@ -829,11 +830,6 @@ process_coarse_timers(struct context *c) #endif /* ENABLE_MANAGEMENT */ } -#if defined(__GNUC__) || defined(__clang__) -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wconversion" -#endif - static void check_coarse_timers(struct context *c) { @@ -1304,6 +1300,11 @@ process_incoming_dco(struct context *c) #endif /* if defined(ENABLE_DCO) && (defined(TARGET_LINUX) || defined(TARGET_FREEBSD)) */ } +#if defined(__GNUC__) || defined(__clang__) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wconversion" +#endif + /* * Output: c->c2.buf */ -- 2.47.3