]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
watchdog: reset last ping timestamp when opening watchdog
authorLennart Poettering <lennart@poettering.net>
Wed, 29 May 2024 15:38:36 +0000 (17:38 +0200)
committerLennart Poettering <lennart@poettering.net>
Wed, 29 May 2024 15:42:02 +0000 (17:42 +0200)
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.

src/shared/watchdog.c

index 720f0343e9c8c0904f0307f5706ed84c1cfa2695..810c5b5206af1823eb5a436c74b02aec56e87970 100644 (file)
@@ -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