cluster-devel.redhat.com archive mirror
 help / color / mirror / Atom feed
From: Fabio M. Di Nitto <fdinitto@redhat.com>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] [PATCH 2/2] cman: fix printing of error if clustername is too long
Date: Fri,  5 Aug 2011 10:08:57 +0200	[thread overview]
Message-ID: <1312531737-27061-2-git-send-email-fdinitto@redhat.com> (raw)
In-Reply-To: <1312531737-27061-1-git-send-email-fdinitto@redhat.com>

Patch 03e9af7db105 did mask an error and was not propagating the
error string in the cman pipe, making it impossible to see the error
at startup when it is more important, since clustername cannot be changed
at runtime.

Resolves: rhbz#728230

Signed-off-by: Fabio M. Di Nitto <fdinitto@redhat.com>
---
 cman/daemon/cman-preconfig.c |   10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/cman/daemon/cman-preconfig.c b/cman/daemon/cman-preconfig.c
index e435484..070761e 100644
--- a/cman/daemon/cman-preconfig.c
+++ b/cman/daemon/cman-preconfig.c
@@ -1274,13 +1274,15 @@ static int get_cman_globals(struct objdb_iface_ver0 *objdb)
 	char *use_hash;
 
 	objdb_get_string(objdb, cluster_parent_handle, "name", &cluster_name);
-	if (!cluster_name || strlen(cluster_name) > 15) {
-		    sprintf(error_reason, "%s\n", "Invalid cluster name. It must be 15 characters or fewer\n");
+	if (!cluster_name) {
+		sprintf(error_reason, "Unable to determine cluster name.\n");
+		write_cman_pipe("Unable to determine cluster name.\n");
 		return -1;
 	}
 
-	if (!cluster_name) {
-		sprintf(error_reason, "Unable to determine cluster name.\n");
+	if (strlen(cluster_name) > 15) {
+		sprintf(error_reason, "%s\n", "Invalid cluster name. It must be 15 characters or fewer\n");
+		write_cman_pipe("Invalid cluster name. It must be 15 characters or fewer\n");
 		return -1;
 	}
 
-- 
1.7.4.4



  reply	other threads:[~2011-08-05  8:08 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-05  8:08 [Cluster-devel] [PATCH 1/2] cman: Print an error if cluster name is too long Fabio M. Di Nitto
2011-08-05  8:08 ` Fabio M. Di Nitto [this message]
2011-08-05  8:30   ` [Cluster-devel] [PATCH 2/2] cman: fix printing of error if clustername " Christine Caulfield

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=1312531737-27061-2-git-send-email-fdinitto@redhat.com \
    --to=fdinitto@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 NNTP newsgroup(s).