2013-06-11 11:22:26 +02:00
|
|
|
From 3608595751f62bbc6d37eb78b746ab6fecfa2d45 Mon Sep 17 00:00:00 2001
|
|
|
|
From: Ross Lagerwall <rosslagerwall@gmail.com>
|
|
|
|
Date: Sun, 9 Jun 2013 17:28:44 +0100
|
|
|
|
Subject: [PATCH 8/8] 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).
|
|
|
|
---
|
|
|
|
src/core/service.c | 2 +-
|
|
|
|
1 file changed, 1 insertion(+), 1 deletion(-)
|
|
|
|
|
2013-06-11 13:22:32 +02:00
|
|
|
Index: systemd-204/src/core/service.c
|
|
|
|
===================================================================
|
|
|
|
--- systemd-204.orig/src/core/service.c
|
|
|
|
+++ systemd-204/src/core/service.c
|
|
|
|
@@ -1933,7 +1933,7 @@ static int main_pid_good(Service *s) {
|
2013-06-11 11:22:26 +02:00
|
|
|
|
|
|
|
/* 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,
|