|
Harald Hoyer |
fe20ad |
From 7372290556ee2df52a0dbd87dc2af6bd610198de Mon Sep 17 00:00:00 2001
|
|
Harald Hoyer |
fe20ad |
From: Lennart Poettering <lennart@poettering.net>
|
|
Harald Hoyer |
fe20ad |
Date: Fri, 9 Aug 2013 16:40:57 +0200
|
|
Harald Hoyer |
fe20ad |
Subject: [PATCH] service: always unwatch PIDs before forgetting old ones
|
|
Harald Hoyer |
fe20ad |
|
|
Harald Hoyer |
fe20ad |
---
|
|
Harald Hoyer |
fe20ad |
src/core/service.c | 9 +++++----
|
|
Harald Hoyer |
fe20ad |
1 file changed, 5 insertions(+), 4 deletions(-)
|
|
Harald Hoyer |
fe20ad |
|
|
Harald Hoyer |
fe20ad |
diff --git a/src/core/service.c b/src/core/service.c
|
|
Harald Hoyer |
fe20ad |
index b98f11a..df49ce1 100644
|
|
Harald Hoyer |
fe20ad |
--- a/src/core/service.c
|
|
Harald Hoyer |
fe20ad |
+++ b/src/core/service.c
|
|
Harald Hoyer |
fe20ad |
@@ -191,6 +191,8 @@ static int service_set_main_pid(Service *s, pid_t pid) {
|
|
Harald Hoyer |
fe20ad |
if (pid == getpid())
|
|
Harald Hoyer |
fe20ad |
return -EINVAL;
|
|
Harald Hoyer |
fe20ad |
|
|
Harald Hoyer |
fe20ad |
+ service_unwatch_main_pid(s);
|
|
Harald Hoyer |
fe20ad |
+
|
|
Harald Hoyer |
fe20ad |
s->main_pid = pid;
|
|
Harald Hoyer |
fe20ad |
s->main_pid_known = true;
|
|
Harald Hoyer |
fe20ad |
|
|
Harald Hoyer |
fe20ad |
@@ -2158,10 +2160,8 @@ static void service_enter_start(Service *s) {
|
|
Harald Hoyer |
fe20ad |
assert(s->exec_command[SERVICE_EXEC_START]);
|
|
Harald Hoyer |
fe20ad |
assert(!s->exec_command[SERVICE_EXEC_START]->command_next || s->type == SERVICE_ONESHOT);
|
|
Harald Hoyer |
fe20ad |
|
|
Harald Hoyer |
fe20ad |
- if (s->type == SERVICE_FORKING)
|
|
Harald Hoyer |
fe20ad |
- service_unwatch_control_pid(s);
|
|
Harald Hoyer |
fe20ad |
- else
|
|
Harald Hoyer |
fe20ad |
- service_unwatch_main_pid(s);
|
|
Harald Hoyer |
fe20ad |
+ service_unwatch_control_pid(s);
|
|
Harald Hoyer |
fe20ad |
+ service_unwatch_main_pid(s);
|
|
Harald Hoyer |
fe20ad |
|
|
Harald Hoyer |
fe20ad |
/* We want to ensure that nobody leaks processes from
|
|
Harald Hoyer |
fe20ad |
* START_PRE here, so let's go on a killing spree, People
|
|
Harald Hoyer |
fe20ad |
@@ -3751,6 +3751,7 @@ static void service_reset_failed(Unit *u) {
|
|
Harald Hoyer |
fe20ad |
|
|
Harald Hoyer |
fe20ad |
static int service_kill(Unit *u, KillWho who, int signo, DBusError *error) {
|
|
Harald Hoyer |
fe20ad |
Service *s = SERVICE(u);
|
|
Harald Hoyer |
fe20ad |
+
|
|
Harald Hoyer |
fe20ad |
return unit_kill_common(u, who, signo, s->main_pid, s->control_pid, error);
|
|
Harald Hoyer |
fe20ad |
}
|
|
Harald Hoyer |
fe20ad |
|