chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
service: pass via FAILED/DEAD before going to AUTO_RESTART
[elogind.git]
/
src
/
core
/
service.c
diff --git
a/src/core/service.c
b/src/core/service.c
index 8941271679adde950d7471d5b854cc46b254b614..d82803db2b634cc4b82322d3e925c27f3c321ed1 100644
(file)
--- a/
src/core/service.c
+++ b/
src/core/service.c
@@
-928,10
+928,6
@@
static int service_load_sysv_path(Service *s, const char *path) {
s->guess_main_pid = false;
s->restart = SERVICE_RESTART_NO;
s->exec_context.ignore_sigpipe = false;
s->guess_main_pid = false;
s->restart = SERVICE_RESTART_NO;
s->exec_context.ignore_sigpipe = false;
-
- if (UNIT(s)->manager->sysv_console)
- s->exec_context.std_output = EXEC_OUTPUT_JOURNAL_AND_CONSOLE;
-
s->exec_context.kill_mode = KILL_PROCESS;
/* We use the long description only if
s->exec_context.kill_mode = KILL_PROCESS;
/* We use the long description only if
@@
-1810,6
+1806,7
@@
static int service_spawn(
UNIT(s)->cgroup_bondings,
UNIT(s)->cgroup_attributes,
is_control ? "control" : NULL,
UNIT(s)->cgroup_bondings,
UNIT(s)->cgroup_attributes,
is_control ? "control" : NULL,
+ UNIT(s)->id,
s->type == SERVICE_IDLE ? UNIT(s)->manager->idle_pipe : NULL,
&pid);
s->type == SERVICE_IDLE ? UNIT(s)->manager->idle_pipe : NULL,
&pid);
@@
-1891,6
+1888,8
@@
static void service_enter_dead(Service *s, ServiceResult f, bool allow_restart)
if (f != SERVICE_SUCCESS)
s->result = f;
if (f != SERVICE_SUCCESS)
s->result = f;
+ service_set_state(s, s->result != SERVICE_SUCCESS ? SERVICE_FAILED : SERVICE_DEAD);
+
if (allow_restart &&
!s->forbid_restart &&
(s->restart == SERVICE_RESTART_ALWAYS ||
if (allow_restart &&
!s->forbid_restart &&
(s->restart == SERVICE_RESTART_ALWAYS ||
@@
-1904,8
+1903,7
@@
static void service_enter_dead(Service *s, ServiceResult f, bool allow_restart)
goto fail;
service_set_state(s, SERVICE_AUTO_RESTART);
goto fail;
service_set_state(s, SERVICE_AUTO_RESTART);
- } else
- service_set_state(s, s->result != SERVICE_SUCCESS ? SERVICE_FAILED : SERVICE_DEAD);
+ }
s->forbid_restart = false;
s->forbid_restart = false;
@@
-2512,7
+2510,7
@@
static int service_stop(Unit *u) {
/* A restart will be scheduled or is in progress. */
if (s->state == SERVICE_AUTO_RESTART) {
/* A restart will be scheduled or is in progress. */
if (s->state == SERVICE_AUTO_RESTART) {
- service_
enter_dead(s, SERVICE_SUCCESS, false
);
+ service_
set_state(s, SERVICE_DEAD
);
return 0;
}
return 0;
}
@@
-3230,7
+3228,7
@@
static void service_cgroup_notify_event(Unit *u) {
case SERVICE_FINAL_SIGTERM:
case SERVICE_FINAL_SIGKILL:
if (main_pid_good(s) <= 0 && !control_pid_good(s))
case SERVICE_FINAL_SIGTERM:
case SERVICE_FINAL_SIGKILL:
if (main_pid_good(s) <= 0 && !control_pid_good(s))
- service_enter_dead(s, SERVICE_SUCCESS,
SERVICE_SUCCESS
);
+ service_enter_dead(s, SERVICE_SUCCESS,
true
);
break;
break;