]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
service: explicit stop the watchdog when we shall not use it
authorLennart Poettering <lennart@poettering.net>
Wed, 24 Oct 2018 16:59:03 +0000 (18:59 +0200)
committerLennart Poettering <lennart@poettering.net>
Fri, 26 Oct 2018 10:53:17 +0000 (12:53 +0200)
This is useful so that WATCHDOG_USEC=0 sent from a process does the
right thing if turning off the watchdog logic.

src/core/service.c

index 510d8d6a3adf23a44cc0cc336522cabe0e2446ef..93f0665bcf05a19f76b5104c80d4bca1c5d8fa4c 100644 (file)
@@ -195,19 +195,21 @@ static usec_t service_get_watchdog_usec(Service *s) {
 
         if (s->watchdog_override_enable)
                 return s->watchdog_override_usec;
-        else
-                return s->watchdog_usec;
+
+        return s->watchdog_original_usec;
 }
 
 static void service_start_watchdog(Service *s) {
-        int r;
         usec_t watchdog_usec;
+        int r;
 
         assert(s);
 
         watchdog_usec = service_get_watchdog_usec(s);
-        if (IN_SET(watchdog_usec, 0, USEC_INFINITY))
+        if (IN_SET(watchdog_usec, 0, USEC_INFINITY)) {
+                service_stop_watchdog(s);
                 return;
+        }
 
         if (s->watchdog_event_source) {
                 r = sd_event_source_set_time(s->watchdog_event_source, usec_add(s->watchdog_timestamp.monotonic, watchdog_usec));