From: Lennart Poettering Date: Wed, 24 Oct 2018 16:59:03 +0000 (+0200) Subject: service: explicit stop the watchdog when we shall not use it X-Git-Tag: v240~462^2~4 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=9fb1cdb4808a65d1c96a99c1b0e53f54ba1b0d3b;p=thirdparty%2Fsystemd.git service: explicit stop the watchdog when we shall not use it This is useful so that WATCHDOG_USEC=0 sent from a process does the right thing if turning off the watchdog logic. --- diff --git a/src/core/service.c b/src/core/service.c index 510d8d6a3ad..93f0665bcf0 100644 --- a/src/core/service.c +++ b/src/core/service.c @@ -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));