X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=elogind.git;a=blobdiff_plain;f=src%2Fservice.c;h=f8b4ff6a246d5c9c5044d2be243513f81f8fa191;hp=b837cb81e59c856d54a5d2a89d8bde6d4fa256f7;hb=b708e7cea941538bfd5e20ce0a723c19b7da7d1d;hpb=3f6c78dcebdc0904d3b614da07e9ec8d84de2532 diff --git a/src/service.c b/src/service.c index b837cb81e..f8b4ff6a2 100644 --- a/src/service.c +++ b/src/service.c @@ -631,6 +631,7 @@ static int service_load_sysv_path(Service *s, const char *path) { goto finish; } + free(u->meta.description); u->meta.description = d; } else if (startswith_no_case(t, "X-Interactive:")) { @@ -2170,7 +2171,6 @@ static void service_sigchld_event(Unit *u, pid_t pid, int code, int status) { assert(pid >= 0); success = is_clean_exit(code, status); - s->failure = s->failure || !success; if (s->main_pid == pid) { @@ -2180,9 +2180,13 @@ static void service_sigchld_event(Unit *u, pid_t pid, int code, int status) { if (s->type != SERVICE_FORKING) { assert(s->exec_command[SERVICE_EXEC_START]); s->exec_command[SERVICE_EXEC_START]->exec_status = s->main_exec_status; + + if (s->exec_command[SERVICE_EXEC_START]->ignore) + success = true; } log_debug("%s: main process exited, code=%s, status=%i", u->meta.id, sigchld_code_to_string(code), status); + s->failure = s->failure || !success; /* The service exited, so the service is officially * gone. */ @@ -2229,12 +2233,17 @@ static void service_sigchld_event(Unit *u, pid_t pid, int code, int status) { } else if (s->control_pid == pid) { - if (s->control_command) + if (s->control_command) { exec_status_exit(&s->control_command->exec_status, pid, code, status); + if (s->control_command->ignore) + success = true; + } + s->control_pid = 0; log_debug("%s: control process exited, code=%s status=%i", u->meta.id, sigchld_code_to_string(code), status); + s->failure = s->failure || !success; /* If we are shutting things down anyway we * don't care about failing commands. */