[SCM] Samba Shared Repository - branch master updated

Volker Lendecke vlendec at samba.org
Sat Jun 27 05:21:04 MDT 2015


The branch, master has been updated
       via  15ac12a ctdb: strip trailing spaces from nodes file.
      from  c5be94c libsmb: Use fstr_sprint in convert_sid_to_string

https://git.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 15ac12af9c00adb05dcdfcb637777b503b87994b
Author: Michael Adam <obnox at samba.org>
Date:   Fri Jun 26 16:24:55 2015 +0200

    ctdb: strip trailing spaces from nodes file.
    
    Signed-off-by: Michael Adam <obnox at samba.org>
    Reviewed-by: Volker Lendecke <vl at samba.org>
    
    Autobuild-User(master): Volker Lendecke <vl at samba.org>
    Autobuild-Date(master): Sat Jun 27 13:20:18 CEST 2015 on sn-devel-104

-----------------------------------------------------------------------

Summary of changes:
 ctdb/common/ctdb_util.c | 17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)


Changeset truncated at 500 lines:

diff --git a/ctdb/common/ctdb_util.c b/ctdb/common/ctdb_util.c
index 5d63c27..709c7a1 100644
--- a/ctdb/common/ctdb_util.c
+++ b/ctdb/common/ctdb_util.c
@@ -548,15 +548,26 @@ struct ctdb_node_map *ctdb_read_nodes_file(TALLOC_CTX *mem_ctx,
 	}
 
 	for (i=0; i < nlines; i++) {
-		const char *node;
+		char *node;
 		uint32_t flags;
+		size_t len;
 
 		node = lines[i];
 		/* strip leading spaces */
 		while((*node == ' ') || (*node == '\t')) {
 			node++;
 		}
-		if (strcmp(node, "") == 0) {
+
+		len = strlen(node);
+
+		while ((len > 1) &&
+		       ((node[len-1] == ' ') || (node[len-1] == '\t')))
+		{
+			node[len-1] = '\0';
+			len--;
+		}
+
+		if (len == 0) {
 			continue;
 		}
 		if (*node == '#') {
@@ -566,7 +577,7 @@ struct ctdb_node_map *ctdb_read_nodes_file(TALLOC_CTX *mem_ctx,
 			   would cause subsequent nodes to change
 			   their PNN. */
 			flags = NODE_FLAGS_DELETED;
-			node = "0.0.0.0";
+			node = discard_const("0.0.0.0");
 		} else {
 			flags = 0;
 		}


-- 
Samba Shared Repository


More information about the samba-cvs mailing list