From 15bb297fbbc4822c37b21bb75c6159ecabd18388 Mon Sep 17 00:00:00 2001
From: Martin C Drohmann <martin@connectedsignals.com>
Date: Wed, 1 Jun 2016 12:12:44 -0700
Subject: [PATCH] Revert changes in daemonize.c from commit
 22d6f39e7fb270d0c011bae820d2f8adc8b19061

---
 lib/daemonize.c | 17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)

diff --git a/lib/daemonize.c b/lib/daemonize.c
index e9162949..73b2d580 100644
--- a/lib/daemonize.c
+++ b/lib/daemonize.c
@@ -142,9 +142,20 @@ lws_daemonize(const char *_lock_path)
 		exit(9);
 	}
 
-	/* If we got a good PID, then we can exit the parent process. */
-	if (pid_daemon > 0)
-		exit(0);
+        /* If we got a good PID, then we can exit the parent process. */
+	if (pid_daemon > 0) {
+
+               /*
+                * Wait for confirmation signal from the child via
+                * SIGCHILD / USR1, or for two seconds to elapse
+                * (SIGALRM).  pause() should not return.
+                */
+               alarm(2);
+
+               pause();
+               /* should not be reachable */
+               exit(1);
+       }
 
 	/* At this point we are executing as the child process */
 	parent = getppid();
-- 
GitLab