diff options
author | Lennart Poettering <lennart@poettering.net> | 2016-10-21 12:27:46 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2016-10-21 12:27:46 +0200 |
commit | 47fffb3530af3e3ad4048570611685635fde062e (patch) | |
tree | 858b12cb263776f98634580db3b037fec428060e | |
parent | d9b8ea5448ba1e61d681a206d770a4eac39b9936 (diff) |
core: if the start command vanishes during runtime don't hit an assert
This can happen when the configuration is changed and reloaded while we are
executing a service. Let's not hit an assert in this case.
Fixes: #4444
-rw-r--r-- | src/core/service.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/core/service.c b/src/core/service.c index f9127d7509..53c26984ca 100644 --- a/src/core/service.c +++ b/src/core/service.c @@ -1756,7 +1756,15 @@ static void service_enter_start(Service *s) { } if (!c) { - assert(s->type == SERVICE_ONESHOT); + if (s->type != SERVICE_ONESHOT) { + /* There's no command line configured for the main command? Hmm, that is strange. This can only + * happen if the configuration changes at runtime. In this case, let's enter a failure + * state. */ + log_unit_error(UNIT(s), "There's no 'start' task anymore we could start: %m"); + r = -ENXIO; + goto fail; + } + service_enter_start_post(s); return; } |