summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRoss Lagerwall <rosslagerwall@gmail.com>2013-06-09 17:28:44 +0100
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2013-06-09 18:26:41 -0400
commit62220cf70e381f6e08390523e4696f7bc431f927 (patch)
tree6decdf5f9e9ea2b813104f70f8176429a3876c8e /src
parent7085053a437456ab87d726f3697002dd811fdf7a (diff)
service: don't report alien child as alive when it's not
When a sigchld is received from an alien child, main_pid is set to 0 then service_enter_running calls main_pid_good to check if the child is running. This incorrectly returned true because kill(main_pid, 0) would return >= 0. This fixes an error where a service would die and the cgroup would become empty but the service would still report as active (running).
Diffstat (limited to 'src')
-rw-r--r--src/core/service.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/core/service.c b/src/core/service.c
index 20990d2a19..dadd98123c 100644
--- a/src/core/service.c
+++ b/src/core/service.c
@@ -1865,7 +1865,7 @@ static int main_pid_good(Service *s) {
/* If it's an alien child let's check if it is still
* alive ... */
- if (s->main_pid_alien)
+ if (s->main_pid_alien && s->main_pid > 0)
return kill(s->main_pid, 0) >= 0 || errno != ESRCH;
/* .. otherwise assume we'll get a SIGCHLD for it,