1
0
mirror of https://github.com/systemd/systemd.git synced 2024-11-02 02:21:44 +03:00

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.
This commit is contained in:
Lennart Poettering 2018-10-24 18:59:03 +02:00
parent 2a1e0f2228
commit 9fb1cdb480

View 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));