diff options
author | Lennart Poettering <lennart@poettering.net> | 2010-08-11 04:02:58 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2010-08-11 04:03:13 +0200 |
commit | 41b02ec77e54871eaa593c50fb31809814f627a7 (patch) | |
tree | 051c24fd80be0968f49de010fd599e1604f40ae5 /src/unit.c | |
parent | 6c073082e7e3859cb6020db8c548325f342b7ba6 (diff) |
unit: make sure a job for a service of type 'finish' succeeds if the process terminates cleanly
Diffstat (limited to 'src/unit.c')
-rw-r--r-- | src/unit.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/unit.c b/src/unit.c index 881f91a677..b93777bec6 100644 --- a/src/unit.c +++ b/src/unit.c @@ -1034,7 +1034,9 @@ void unit_notify(Unit *u, UnitActiveState os, UnitActiveState ns) { job_finish_and_invalidate(u->meta.job, true); else if (u->meta.job->state == JOB_RUNNING && ns != UNIT_ACTIVATING) { unexpected = true; - job_finish_and_invalidate(u->meta.job, false); + + if (UNIT_IS_INACTIVE_OR_MAINTENANCE(ns)) + job_finish_and_invalidate(u->meta.job, ns != UNIT_MAINTENANCE); } break; @@ -1047,7 +1049,9 @@ void unit_notify(Unit *u, UnitActiveState os, UnitActiveState ns) { job_finish_and_invalidate(u->meta.job, true); else if (ns != UNIT_ACTIVATING && ns != UNIT_RELOADING) { unexpected = true; - job_finish_and_invalidate(u->meta.job, false); + + if (UNIT_IS_INACTIVE_OR_MAINTENANCE(ns)) + job_finish_and_invalidate(u->meta.job, ns != UNIT_MAINTENANCE); } } @@ -1057,7 +1061,7 @@ void unit_notify(Unit *u, UnitActiveState os, UnitActiveState ns) { case JOB_RESTART: case JOB_TRY_RESTART: - if (ns == UNIT_INACTIVE || ns == UNIT_MAINTENANCE) + if (UNIT_IS_INACTIVE_OR_MAINTENANCE(ns)) job_finish_and_invalidate(u->meta.job, true); else if (u->meta.job->state == JOB_RUNNING && ns != UNIT_DEACTIVATING) { unexpected = true; |