chiark / gitweb /
service: for Type=forking services, ignore exit status of main process depending...
authorLennart Poettering <lennart@poettering.net>
Mon, 14 Jan 2013 20:05:17 +0000 (21:05 +0100)
committerLennart Poettering <lennart@poettering.net>
Mon, 14 Jan 2013 20:05:17 +0000 (21:05 +0100)
https://bugzilla.redhat.com/show_bug.cgi?id=860464

src/core/service.c

index 8e9e11236d9c683b7f7b2fd0b753753f691690c6..7eaac0dc4cb7e9f4437cdaca5282be9be280e3c6 100644 (file)
@@ -2926,15 +2926,25 @@ static void service_sigchld_event(Unit *u, pid_t pid, int code, int status) {
                 s->main_pid = 0;
                 exec_status_exit(&s->main_exec_status, &s->exec_context, pid, code, status);
 
                 s->main_pid = 0;
                 exec_status_exit(&s->main_exec_status, &s->exec_context, pid, code, status);
 
-                /* If this is not a forking service than the main
-                 * process got started and hence we copy the exit
-                 * status so that it is recorded both as main and as
-                 * control process exit status */
                 if (s->main_command) {
                 if (s->main_command) {
+                        /* If this is not a forking service than the
+                         * main process got started and hence we copy
+                         * the exit status so that it is recorded both
+                         * as main and as control process exit
+                         * status */
+
                         s->main_command->exec_status = s->main_exec_status;
 
                         if (s->main_command->ignore)
                                 f = SERVICE_SUCCESS;
                         s->main_command->exec_status = s->main_exec_status;
 
                         if (s->main_command->ignore)
                                 f = SERVICE_SUCCESS;
+                } else if (s->exec_command[SERVICE_EXEC_START]) {
+
+                        /* If this is a forked process, then we should
+                         * ignore the return value if this was
+                         * configured for the starter process */
+
+                        if (s->exec_command[SERVICE_EXEC_START]->ignore)
+                                f = SERVICE_SUCCESS;
                 }
 
                 log_struct(f == SERVICE_SUCCESS ? LOG_DEBUG : LOG_NOTICE,
                 }
 
                 log_struct(f == SERVICE_SUCCESS ? LOG_DEBUG : LOG_NOTICE,