From 39ac438b8d70d525e765a1864e7655cfea77fdc8 Mon Sep 17 00:00:00 2001 From: Adam Date: Thu, 27 Oct 2011 15:09:31 -0400 Subject: [PATCH] Ignore sigchld/usr2 sent to the child process after fork --- src/init.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/init.cpp b/src/init.cpp index bcf49f00b..866b51388 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -249,6 +249,8 @@ void Fork() } #ifndef _WIN32 +static bool in_parent = false; + class SignalForkExit : public Signal { public: @@ -256,6 +258,9 @@ class SignalForkExit : public Signal void OnNotify() { + if (!in_parent) + return; + quitting = true; return_code = 0; } @@ -268,6 +273,9 @@ class SignalSigChld : public Signal void OnNotify() { + if (!in_parent) + return; + quitting = true; return_code = -1; int status = 0; @@ -414,6 +422,7 @@ void Init(int ac, char **av) int i = fork(); if (i > 0) { + in_parent = true; while (!quitting) { Log(LOG_DEBUG_3) << "Top of fork() process loop";