From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 20219 invoked by alias); 30 Jul 2009 11:46:23 -0000 Received: (qmail 20212 invoked by alias); 30 Jul 2009 11:46:23 -0000 X-SWARE-Spam-Status: No, hits=-1.9 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS X-Spam-Status: No, hits=-1.9 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS X-Spam-Check-By: sourceware.org X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on bastion2.fedora.phx.redhat.com Subject: cluster: STABLE3 - cman: Enable error reporting from config modules To: cluster-cvs-relay@redhat.com X-Project: Cluster Project X-Git-Module: cluster.git X-Git-Refname: refs/heads/STABLE3 X-Git-Reftype: branch X-Git-Oldrev: beb2da8139a20d81af6bb1e11a6de66838cf0c90 X-Git-Newrev: 9e528cda909d18026aae484958e07303d7cdf0d9 From: Christine Caulfield Message-Id: <20090730114554.C83A61201A5@lists.fedorahosted.org> Date: Thu, 30 Jul 2009 11:46:00 -0000 X-Scanned-By: MIMEDefang 2.58 on 172.16.52.254 Mailing-List: contact cluster-cvs-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: cluster-cvs-owner@sourceware.org X-SW-Source: 2009-q3/txt/msg00137.txt.bz2 Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=9e528cda909d18026aae484958e07303d7cdf0d9 Commit: 9e528cda909d18026aae484958e07303d7cdf0d9 Parent: beb2da8139a20d81af6bb1e11a6de66838cf0c90 Author: Christine Caulfield AuthorDate: Thu Jul 30 12:39:06 2009 +0100 Committer: Christine Caulfield CommitterDate: Thu Jul 30 12:39:06 2009 +0100 cman: Enable error reporting from config modules The closure of stderr has been moved from cman_tool into cman-preconfig, this means that any errors reported to stderr by (eg) libXML will appear on the console when cman starts up. Signed-off-by: Christine Caulfield --- cman/cman_tool/join.c | 17 ++++++----------- cman/daemon/cman-preconfig.c | 6 ++++++ 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/cman/cman_tool/join.c b/cman/cman_tool/join.c index 2a0e017..78c400e 100644 --- a/cman/cman_tool/join.c +++ b/cman/cman_tool/join.c @@ -10,7 +10,7 @@ static char *argv[MAX_ARGS]; static char *envp[MAX_ARGS]; -static void be_daemon(int close_stderr) +static void be_daemon(void) { int devnull = open("/dev/null", O_RDWR); if (devnull == -1) { @@ -27,15 +27,10 @@ static void be_daemon(int close_stderr) die("Error setting terminal FDs to /dev/null: %m"); } - if (close_stderr) { - if (close(2)) { - die("Error closing stderr FD"); - } - if (!dup2(devnull, 2) < 0) { - die("Error setting stderr FD to /dev/null: %m"); - } - } - + /* We leave stderr open to allow error messags through. + the cman plugin will close it when it's all started + up properly. + */ setsid(); } @@ -226,7 +221,7 @@ int join(commandline_t *comline, char *main_envp[]) fprintf(stderr, "%s\n", envp[i]); } } - be_daemon(!(comline->verbose & ~DEBUG_STARTUP_ONLY)); + be_daemon(); sprintf(scratch, "FORKED: %d\n", getpid()); err = write(p[1], scratch, strlen(scratch)); diff --git a/cman/daemon/cman-preconfig.c b/cman/daemon/cman-preconfig.c index 8c490df..4cdd00d 100644 --- a/cman/daemon/cman-preconfig.c +++ b/cman/daemon/cman-preconfig.c @@ -1232,6 +1232,12 @@ static int cmanpre_readconfig(struct objdb_iface_ver0 *objdb, const char **error } *error_string = error_reason; + + /* Close stderr, because cman_tool tells corosync not to. + This helps pass error messages back to the command-line + */ + if (!debug) + close(STDERR_FILENO); return ret; }