From 2bd84dcfbdf084bcfb3e6d7c26756ca3783cdae4 Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Fri, 19 Oct 2012 10:20:40 -0400 Subject: [PATCH 41/42] Don't return quite so immediately if we're the parent pid when daemonizing. Long term we probably want to look for the socket and/or sigchld instead of this. Signed-off-by: Peter Jones --- src/daemon.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/daemon.c b/src/daemon.c index bf7485f..6951f0a 100644 --- a/src/daemon.c +++ b/src/daemon.c @@ -885,8 +885,10 @@ daemonize(cms_context *cms_ctx, int do_fork) if (do_fork) { pid_t pid; - if ((pid = fork())) + if ((pid = fork())) { + sleep(2); return 0; + } } ctx.pid = getpid(); write_pid_file(ctx.pid); -- 1.7.12.1