chiark / gitweb /
core: disarm shutdown watchdog if we fail to set timeout
authorLennart Poettering <lennart@poettering.net>
Thu, 12 Feb 2015 11:28:48 +0000 (12:28 +0100)
committerLennart Poettering <lennart@poettering.net>
Thu, 12 Feb 2015 11:28:48 +0000 (12:28 +0100)
Better safe than sorry, if drivers are stupid, and reset immediately on
device closing if the timeout could not be initialized.

https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=777735

src/core/main.c

index 0749f04..ba2de85 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)