From 1cef8ebf6ec3e7ac63b292c53cc6f80f4e2b8a81 Mon Sep 17 00:00:00 2001 From: Augustin Cavalier Date: Tue, 7 Jun 2022 14:41:15 -0400 Subject: [PATCH] freebsd_network: Fix ticks check in callout_reset. "ticks" is the name of the global variable indicating time since system start; "_ticks" is the local variable. The confusion between the two caused every callout to be invoked as soon as it was instantiated. I am pretty surprised this was not noticed before. I only discovered it just now while working on the OpenBSD WiFi driver ports. Seems it has been broken like this for multiple years... --- src/libs/compat/freebsd_network/callout.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libs/compat/freebsd_network/callout.cpp b/src/libs/compat/freebsd_network/callout.cpp index 009366b5ba..e91416c846 100644 --- a/src/libs/compat/freebsd_network/callout.cpp +++ b/src/libs/compat/freebsd_network/callout.cpp @@ -186,7 +186,7 @@ callout_reset(struct callout *c, int _ticks, void (*func)(void *), void *arg) TRACE("callout_reset %p, func %p, arg %p\n", c, c->c_func, c->c_arg); - if (ticks >= 0) { + if (_ticks >= 0) { // reschedule or add this timer if (c->due <= 0) list_add_item(&sTimers, c);