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.
This commit is contained in:
Lennart Poettering 2024-05-29 17:38:36 +02:00
parent e7f0053787
commit bbd3832e6b

View 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