[PATCH 5/6] totemconfig: ensure suffix for ringX_addr

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Patch makes sure, that ringX_addr key has really _addr suffix.
Previously, it was possible to enter ringXanything and it was
interpreted as ringX_addr.

Signed-off-by: Jan Friesse <jfriesse@xxxxxxxxxx>
---
 exec/totemconfig.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/exec/totemconfig.c b/exec/totemconfig.c
index ec09b4c..f84687c 100644
--- a/exec/totemconfig.c
+++ b/exec/totemconfig.c
@@ -267,6 +267,7 @@ static void put_nodelist_members_to_config(struct totem_config *totem_config)
 	int res = 0;
 	int node_pos;
 	char tmp_key[ICMAP_KEYNAME_MAXLEN];
+	char tmp_key2[ICMAP_KEYNAME_MAXLEN];
 	char *node_addr_str;
 	int member_count;
 	unsigned int ringnumber = 0;
@@ -285,8 +286,8 @@ static void put_nodelist_members_to_config(struct totem_config *totem_config)
 		snprintf(tmp_key, ICMAP_KEYNAME_MAXLEN, "nodelist.node.%u.", node_pos);
 		iter2 = icmap_iter_init(tmp_key);
 		while ((iter_key2 = icmap_iter_next(iter2, NULL, NULL)) != NULL) {
-			res = sscanf(iter_key2, "nodelist.node.%u.ring%u_addr", &node_pos, &ringnumber);
-			if (res != 2) {
+			res = sscanf(iter_key2, "nodelist.node.%u.ring%u%s", &node_pos, &ringnumber, tmp_key2);
+			if (res != 3 || strcmp(tmp_key2, "_addr") != 0) {
 				continue;
 			}
 
-- 
1.7.1

_______________________________________________
discuss mailing list
discuss@xxxxxxxxxxxx
http://lists.corosync.org/mailman/listinfo/discuss


[Index of Archives]     [Linux Clusters]     [Corosync Project]     [Linux USB Devel]     [Linux Audio Users]     [Photo]     [Yosemite News]    [Yosemite Photos]    [Linux Kernel]     [Linux SCSI]     [X.Org]

  Powered by Linux