diff options
Diffstat (limited to 'src/ctl.c')
-rw-r--r-- | src/ctl.c | 16 |
1 files changed, 9 insertions, 7 deletions
@@ -1877,19 +1877,21 @@ static int fun_start (struct json_value *result, struct prog *prog) { - if (prog->v.p.status == status_disabled) + switch (prog->v.p.status) { + case status_disabled: prog->v.p.comp->flags &= ~CF_DISABLED; prog->v.p.status = status_enabled; json_object_set_string (result, "status", "OK"); - } - else if (prog->v.p.status == status_sleeping) - { + break; + + case status_sleeping: + case status_finished: prog->v.p.status = status_enabled; prog->v.p.failcount = 0; prog->v.p.timestamp = 0; json_object_set_string (result, "status", "OK"); - } - else - { + break; + + default: json_object_set_string (result, "status", "ER"); json_object_set_string (result, "error_message", "already running"); |