core: close watchdog device if watchdog device is unspecified now

If a watchdog device was specified previously, and unspecified later and
PID1 is reloaded, then we need to close the device.
This commit is contained in:
Yu Watanabe
2022-06-22 16:23:36 +09:00
parent e83c4d178b
commit 82d7a151db
+3 -5
View File
@@ -2118,11 +2118,9 @@ static int initialize_runtime(
write_container_id(); write_container_id();
} }
if (arg_watchdog_device) { r = watchdog_set_device(arg_watchdog_device);
r = watchdog_set_device(arg_watchdog_device); if (r < 0)
if (r < 0) log_warning_errno(r, "Failed to set watchdog device to %s, ignoring: %m", arg_watchdog_device);
log_warning_errno(r, "Failed to set watchdog device to %s, ignoring: %m", arg_watchdog_device);
}
} else { } else {
_cleanup_free_ char *p = NULL; _cleanup_free_ char *p = NULL;