]> git.ipfire.org Git - thirdparty/systemd.git/blobdiff - src/core/scope.c
scope: only stop watching processes when we go down
[thirdparty/systemd.git] / src / core / scope.c
index d8860a6da1c210bc5051e6224ef3c58108ad2537..1bcd4ed84f29ade6770ed4ee6060ec3e91ea212d 100644 (file)
@@ -119,7 +119,7 @@ static void scope_set_state(Scope *s, ScopeState state) {
         if (!IN_SET(state, SCOPE_STOP_SIGTERM, SCOPE_STOP_SIGKILL, SCOPE_START_CHOWN, SCOPE_RUNNING))
                 s->timer_event_source = sd_event_source_disable_unref(s->timer_event_source);
 
-        if (IN_SET(state, SCOPE_DEAD, SCOPE_FAILED)) {
+        if (!IN_SET(old_state, SCOPE_DEAD, SCOPE_FAILED) && IN_SET(state, SCOPE_DEAD, SCOPE_FAILED)) {
                 unit_unwatch_all_pids(UNIT(s));
                 unit_dequeue_rewatch_pids(UNIT(s));
         }