aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLaurent Bachelier <laurent@bachelier.name>2010-12-27 18:55:48 +0100
committerLaurent Bachelier <laurent@bachelier.name>2010-12-27 18:55:48 +0100
commit6cc3641fb2fa1c200cce39a8b9951b8fc2034171 (patch)
treeb97b8e80affe058e210658191da6cb35fc543490
parentUpdate documentation and enhance messages (diff)
downloadsymfttpd-6cc3641fb2fa1c200cce39a8b9951b8fc2034171.tar.xz
Properly exit when the child is defunct
-rwxr-xr-xspawn7
1 files changed, 6 insertions, 1 deletions
diff --git a/spawn b/spawn
index 0c7b8ad..657470d 100755
--- a/spawn
+++ b/spawn
@@ -113,7 +113,6 @@ else
{
// Parent process
$prev_genconf = null;
- // TODO exit if lighttpd is properly killed (with -K for instance)
while (true)
{
sleep(1);
@@ -126,6 +125,12 @@ else
!PosixTools::killPid($options['pidfile']);
}
$prev_genconf = $genconf;
+
+ // If the children is defunct, we are finished here
+ if (pcntl_waitpid($pid, $status, WNOHANG))
+ {
+ exit(0);
+ }
}
}
elseif ($pid == 0)