public inbox for cluster-cvs@sourceware.org
help / color / mirror / Atom feed
From: Christine Caulfield <chrissie@fedoraproject.org>
To: cluster-cvs-relay@redhat.com
Subject: cluster: STABLE3 - cman: Enable error reporting from config modules
Date: Thu, 30 Jul 2009 11:46:00 -0000	[thread overview]
Message-ID: <20090730114554.C83A61201A5@lists.fedorahosted.org> (raw)

Gitweb:        http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=9e528cda909d18026aae484958e07303d7cdf0d9
Commit:        9e528cda909d18026aae484958e07303d7cdf0d9
Parent:        beb2da8139a20d81af6bb1e11a6de66838cf0c90
Author:        Christine Caulfield <ccaulfie@redhat.com>
AuthorDate:    Thu Jul 30 12:39:06 2009 +0100
Committer:     Christine Caulfield <ccaulfie@redhat.com>
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 <ccaulfie@redhat.com>
---
 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;
 }
 


                 reply	other threads:[~2009-07-30 11:46 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20090730114554.C83A61201A5@lists.fedorahosted.org \
    --to=chrissie@fedoraproject.org \
    --cc=cluster-cvs-relay@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).