From 896318f47541ea678a947a43a56fa6dda67e2465 Mon Sep 17 00:00:00 2001 From: Patrick Caulfield Date: Thu, 30 Sep 2004 14:16:28 +0000 Subject: [PATCH] Fork a little later in the startup sequence so that we can return an error code if the cluster infrastructure isn't there. --- daemons/clvmd/clvmd.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/daemons/clvmd/clvmd.c b/daemons/clvmd/clvmd.c index cb936426c..81137a241 100644 --- a/daemons/clvmd/clvmd.c +++ b/daemons/clvmd/clvmd.c @@ -175,11 +175,6 @@ int main(int argc, char *argv[]) } } - /* Fork into the background (unless requested not to) */ - if (!debug) { - be_daemon(); - } - DEBUGLOG("CLVMD started\n"); /* Open the Unix socket we listen for commands on. @@ -215,6 +210,12 @@ int main(int argc, char *argv[]) log_error("Can't initialise cluster interface\n"); exit(5); } + + /* Fork into the background (unless requested not to) */ + if (!debug) { + be_daemon(); + } + DEBUGLOG("Cluster ready, doing some more initialisation\n"); /* Save our CSID */ @@ -228,8 +229,10 @@ int main(int argc, char *argv[]) /* Add the local socket to the list */ newfd = malloc(sizeof(struct local_client)); - if (!newfd) + if (!newfd) { + log_error("Can't allocate memory for socket structures. shutting down\n"); exit(2); + } newfd->fd = local_sock; newfd->type = LOCAL_RENDEZVOUS; -- 2.43.5