core: do not restart a service with Restart=always when ExecCondition fails

When a Condition*= fails, and a service has Restart=always,
the service is not restarted.
Follow the same behaviour for ExecCondition= to avoid inconsistencies.

Fixes #22257
This commit is contained in:
Luca Boccassi
2022-01-26 19:02:11 +00:00
parent 9d3bb25b2d
commit abb99360d3
3 changed files with 13 additions and 1 deletions
+1 -1
View File
@@ -1798,7 +1798,7 @@ static bool service_shall_restart(Service *s, const char **reason) {
return false;
case SERVICE_RESTART_ALWAYS:
return true;
return s->result != SERVICE_SKIP_CONDITION;
case SERVICE_RESTART_ON_SUCCESS:
return s->result == SERVICE_SUCCESS;