chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
unit: accept empty defaults for kill who/mode args
[elogind.git]
/
src
/
service.c
diff --git
a/src/service.c
b/src/service.c
index 165655eb124c8bc200d69f0e642eced721970932..0b657679f7391fe4f630ba1f0e48f2dd46f10af8 100644
(file)
--- a/
src/service.c
+++ b/
src/service.c
@@
-843,7
+843,7
@@
static int service_load_sysv_path(Service *s, const char *path) {
/* Special setting for all SysV services */
s->type = SERVICE_FORKING;
/* Special setting for all SysV services */
s->type = SERVICE_FORKING;
- s->remain_after_exit =
tru
e;
+ s->remain_after_exit =
!s->pid_fil
e;
s->restart = SERVICE_RESTART_NO;
s->exec_context.std_output =
(s->meta.manager->sysv_console || s->exec_context.std_input == EXEC_INPUT_TTY)
s->restart = SERVICE_RESTART_NO;
s->exec_context.std_output =
(s->meta.manager->sysv_console || s->exec_context.std_input == EXEC_INPUT_TTY)
@@
-1496,7
+1496,7
@@
static void service_set_state(Service *s, ServiceState state) {
/* For the inactive states unit_notify() will trim the cgroup,
* but for exit we have to do that ourselves... */
/* For the inactive states unit_notify() will trim the cgroup,
* but for exit we have to do that ourselves... */
- if (state == SERVICE_EXITED && s->meta.manager->n_
deserializ
ing <= 0)
+ if (state == SERVICE_EXITED && s->meta.manager->n_
reload
ing <= 0)
cgroup_bonding_trim_list(s->meta.cgroup_bondings, true);
if (old_state != state)
cgroup_bonding_trim_list(s->meta.cgroup_bondings, true);
if (old_state != state)
@@
-3270,15
+3270,17
@@
static int service_kill(Unit *u, KillWho who, KillMode mode, int signo, DBusErro
return -ENOENT;
}
return -ENOENT;
}
- if (s->control_pid > 0)
- if (kill(s->control_pid, signo) < 0)
- r = -errno;
+ if (who == KILL_CONTROL || who == KILL_ALL)
+ if (s->control_pid > 0)
+ if (kill(s->control_pid, signo) < 0)
+ r = -errno;
- if (s->main_pid > 0)
- if (kill(s->main_pid, signo) < 0)
- r = -errno;
+ if (who == KILL_MAIN || who == KILL_ALL)
+ if (s->main_pid > 0)
+ if (kill(s->main_pid, signo) < 0)
+ r = -errno;
- if (mode == KILL_CONTROL_GROUP) {
+ if (
who == KILL_ALL &&
mode == KILL_CONTROL_GROUP) {
int q;
if (!(pid_set = set_new(trivial_hash_func, trivial_compare_func)))
int q;
if (!(pid_set = set_new(trivial_hash_func, trivial_compare_func)))
@@
-3298,7
+3300,7
@@
static int service_kill(Unit *u, KillWho who, KillMode mode, int signo, DBusErro
}
if ((q = cgroup_bonding_kill_list(s->meta.cgroup_bondings, signo, false, pid_set)) < 0)
}
if ((q = cgroup_bonding_kill_list(s->meta.cgroup_bondings, signo, false, pid_set)) < 0)
- if (
r != -EAGAIN && r != -ESRCH && r
!= -ENOENT)
+ if (
q != -EAGAIN && q != -ESRCH && q
!= -ENOENT)
r = q;
}
r = q;
}