public inbox for cluster-cvs@sourceware.org
help / color / mirror / Atom feed
From: "Fabio M. Di Nitto" <fabbione@fedoraproject.org>
To: cluster-cvs-relay@redhat.com
Subject: cluster: STABLE3 - ccs: allow random config_versions
Date: Wed, 28 Jan 2009 09:32:00 -0000	[thread overview]
Message-ID: <20090128092922.BD3A712055D@lists.fedorahosted.org> (raw)

Gitweb:        http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=c8fdad1dca1d65cb3a96ce48006142bfa0dc8fa3
Commit:        c8fdad1dca1d65cb3a96ce48006142bfa0dc8fa3
Parent:        df1733ed0d1849bd00d585769a39c850caad4c55
Author:        Fabio M. Di Nitto <fdinitto@redhat.com>
AuthorDate:    Wed Jan 28 10:28:45 2009 +0100
Committer:     Fabio M. Di Nitto <fdinitto@redhat.com>
CommitterDate: Wed Jan 28 10:28:45 2009 +0100

ccs: allow random config_versions

fix a bug that made libccs go boom on config_version < 0.

Signed-off-by: Fabio M. Di Nitto <fdinitto@redhat.com>
---
 config/libs/libccsconfdb/libccs.c |   19 +++++++++----------
 1 files changed, 9 insertions(+), 10 deletions(-)

diff --git a/config/libs/libccsconfdb/libccs.c b/config/libs/libccsconfdb/libccs.c
index 1f60946..d78fc26 100644
--- a/config/libs/libccsconfdb/libccs.c
+++ b/config/libs/libccsconfdb/libccs.c
@@ -122,7 +122,7 @@ static int destroy_ccs_handle(confdb_handle_t handle,
 	return 0;
 }
 
-static int get_running_config_version(confdb_handle_t handle)
+static int get_running_config_version(confdb_handle_t handle, int *config_version)
 {
 	unsigned int cluster_handle;
 	char data[128];
@@ -141,7 +141,8 @@ static int get_running_config_version(confdb_handle_t handle)
 		if (confdb_key_get
 		    (handle, cluster_handle, "config_version",
 		     strlen("config_version"), data, &datalen) == CS_OK) {
-			ret = atoi(data);
+			*config_version = atoi(data);
+			ret = 0;
 		}
 	}
 
@@ -154,7 +155,7 @@ static int get_running_config_version(confdb_handle_t handle)
 }
 
 static int get_stored_config_version(confdb_handle_t handle,
-				     unsigned int connection_handle)
+				     unsigned int connection_handle, int *config_version)
 {
 	char data[128];
 	int datalen = 0;
@@ -163,7 +164,8 @@ static int get_stored_config_version(confdb_handle_t handle,
 	if (confdb_key_get
 	    (handle, connection_handle, "config_version",
 	     strlen("config_version"), data, &datalen) == CS_OK) {
-		ret = atoi(data);
+		*config_version = atoi(data);
+		ret = 0;
 	}
 
 	if (ret < 0)
@@ -202,12 +204,10 @@ static int config_reload(confdb_handle_t handle,
 	int running_version;
 	int stored_version;
 
-	running_version = get_running_config_version(handle);
-	if (running_version < 0)
+	if(get_running_config_version(handle, &running_version) < 0)
 		return -1;
 
-	stored_version = get_stored_config_version(handle, connection_handle);
-	if (stored_version < 0)
+	if (get_stored_config_version(handle, connection_handle, &stored_version) < 0)
 		return -1;
 
 	if (running_version == stored_version)
@@ -244,8 +244,7 @@ static unsigned int create_ccs_handle(confdb_handle_t handle, int ccs_handle,
 	if (libccs_handle == -1)
 		return -1;
 
-	config_version = get_running_config_version(handle);
-	if (config_version < 0)
+	if (get_running_config_version(handle, &config_version) < 0)
 		return -1;
 
 	if (confdb_object_create


                 reply	other threads:[~2009-01-28  9:32 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=20090128092922.BD3A712055D@lists.fedorahosted.org \
    --to=fabbione@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).