diff --git a/src/shared/watchdog.c b/src/shared/watchdog.c index e8184ff661..e4cc0926f7 100644 --- a/src/shared/watchdog.c +++ b/src/shared/watchdog.c @@ -133,6 +133,10 @@ static int open_watchdog(void) { fn = !watchdog_device || path_equal(watchdog_device, "/dev/watchdog") ? "/dev/watchdog0" : watchdog_device; + r = free_and_strdup(&watchdog_device, fn); + if (r < 0) + return log_oom_debug(); + watchdog_fd = open(fn, O_WRONLY|O_CLOEXEC); if (watchdog_fd < 0) return log_debug_errno(errno, "Failed to open watchdog device %s, ignoring: %m", fn); diff --git a/src/shutdown/shutdown.c b/src/shutdown/shutdown.c index 15fd6f93d3..2c3cbec02c 100644 --- a/src/shutdown/shutdown.c +++ b/src/shutdown/shutdown.c @@ -531,8 +531,9 @@ int main(int argc, char *argv[]) { need_md_detach ? " MD devices," : ""); } - /* We're done with the watchdog. */ - watchdog_close(true); + /* We're done with the watchdog. Note that the watchdog is explicitly not + * stopped here. It remains active to guard against any issues during the + * rest of the shutdown sequence. */ watchdog_free_device(); arguments[0] = NULL;