chiark / gitweb /
core: disarm shutdown watchdog if we fail to set timeout
[elogind.git] / src / core / main.c
index 0749f0413a7aca481b6964e0ed98c9dc4db4820a..ba2de85bd3345dfdcef803a9abbccdeb8802acc6 100644 (file)
@@ -2021,8 +2021,8 @@ finish:
                         /* If we reboot let's set the shutdown
                          * watchdog and tell the shutdown binary to
                          * repeatedly ping it */
-                        watchdog_set_timeout(&arg_shutdown_watchdog);
-                        watchdog_close(false);
+                        r = watchdog_set_timeout(&arg_shutdown_watchdog);
+                        watchdog_close(r < 0);
 
                         /* Tell the binary how often to ping, ignore failure */
                         if (asprintf(&e, "WATCHDOG_USEC="USEC_FMT, arg_shutdown_watchdog) > 0)