From: Lennart Poettering Date: Wed, 29 May 2024 15:38:36 +0000 (+0200) Subject: watchdog: reset last ping timestamp when opening watchdog X-Git-Tag: v256-rc4~88^2~2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=bbd3832e6bac0c945cfb2632b872e4bccb111f2b;p=thirdparty%2Fsystemd.git watchdog: reset last ping timestamp when opening watchdog When we open a watchdog fresh we have never pinged it, hence reset the ping timestamp explicitly, so that it is not only reset the first time we open the device, but all times. --- diff --git a/src/shared/watchdog.c b/src/shared/watchdog.c index 720f0343e9c..810c5b5206a 100644 --- a/src/shared/watchdog.c +++ b/src/shared/watchdog.c @@ -340,6 +340,8 @@ static int watchdog_open(void) { if (watchdog_fd < 0) return log_debug_errno(SYNTHETIC_ERRNO(ENOENT), "Failed to open watchdog device %s.", watchdog_device ?: "auto"); + watchdog_last_ping = USEC_INFINITY; + if (ioctl(watchdog_fd, WDIOC_GETSUPPORT, &ident) < 0) log_debug_errno(errno, "Hardware watchdog %s does not support WDIOC_GETSUPPORT ioctl, ignoring: %m", watchdog_device); else