summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoachim Nilsson <troglobit@gmail.com>2019-05-26 12:35:09 (GMT)
committerJoachim Nilsson <troglobit@gmail.com>2019-05-26 12:35:09 (GMT)
commit4927d01744e58a45b39d7a509547d807770385da (patch)
treee82fc099b6f5542bdfe66a07e41fb5597ab89f97
parentd043e43550b15cb206206d08f1a5ed516e4db735 (diff)
Disable, and re-enable the supervisor first when disabling watchdogd
When disabling watchdogd with the API we don't want to have any spurious timer callbacks from the supervisor, so let's disable it first. Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
-rw-r--r--src/wdt.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/wdt.c b/src/wdt.c
index dad80ac..e5c51fe 100644
--- a/src/wdt.c
+++ b/src/wdt.c
@@ -440,6 +440,13 @@ int wdt_enable(int enable)
if (enabled == enable)
return 0; /* Hello? Yes, this is dog */
+ /* Stop/Start process supervisor */
+ DEBUG("%sabling supervisor ...", enable ? "En" : "Dis");
+ result += supervisor_enable(enable);
+ if (!result)
+ enabled = enable;
+
+ DEBUG("%sabling watchdogd ...", enable ? "En" : "Dis");
if (!enable) {
/* Attempt to disable HW watchdog */
while (fd != -1) {
@@ -459,12 +466,6 @@ int wdt_enable(int enable)
result += wdt_init(NULL, NULL);
}
- /* Stop/Start process supervisor */
- DEBUG("%sabling supervisor ...", enable ? "En" : "Dis");
- result += supervisor_enable(enable);
- if (!result)
- enabled = enable;
-
return result;
}