This is the mail archive of the cluster-cvs@sourceware.org mailing list for the cluster.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

cluster: master - ccs: allow random config_versions


Gitweb:        http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=8e8918f3d0db152a3c5705bca91bfd4945c0cafe
Commit:        8e8918f3d0db152a3c5705bca91bfd4945c0cafe
Parent:        4f9794db2ef36e061ce41cfcc2d8a00b64b8b344
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:30:14 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]