]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
core: close watchdog device if watchdog device is unspecified now 23802/head
authorYu Watanabe <watanabe.yu+github@gmail.com>
Wed, 22 Jun 2022 07:22:39 +0000 (16:22 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Wed, 22 Jun 2022 07:23:36 +0000 (16:23 +0900)
If a watchdog device was specified previously, and unspecified later and
PID1 is reloaded, then we need to close the device.

src/core/main.c

index b796dc8c2a06f05af85d7400098d92cd2dc6b3d4..7cd13b9e13e8aecbddc38566c94ee1d6d1386b08 100644 (file)
@@ -2118,11 +2118,9 @@ static int initialize_runtime(
                         write_container_id();
                 }
 
-                if (arg_watchdog_device) {
-                        r = watchdog_set_device(arg_watchdog_device);
-                        if (r < 0)
-                                log_warning_errno(r, "Failed to set watchdog device to %s, ignoring: %m", arg_watchdog_device);
-                }
+                r = watchdog_set_device(arg_watchdog_device);
+                if (r < 0)
+                        log_warning_errno(r, "Failed to set watchdog device to %s, ignoring: %m", arg_watchdog_device);
         } else {
                 _cleanup_free_ char *p = NULL;