[SCM] Samba Shared Repository - branch v4-2-test updated

Karolin Seeger kseeger at samba.org
Mon Nov 2 12:58:04 UTC 2015


The branch, v4-2-test has been updated
       via  1998b07 ctdb: strip trailing spaces from nodes file.
      from  f0238b7 ctdb: open the RO tracking db with perms 0600 instead of 0000

https://git.samba.org/?p=samba.git;a=shortlog;h=v4-2-test


- Log -----------------------------------------------------------------
commit 1998b070ed1f4b4dfe836bf3f30ae1eb75b92ce6
Author: Michael Adam <obnox at samba.org>
Date:   Wed Oct 28 19:39:41 2015 +0100

    ctdb: strip trailing spaces from nodes file.
    
    This is essentially commit 15ac12af9c00adb05dcdfcb637777b503b87994b
    from master backported.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=11365
    
    Signed-off-by: Michael Adam <obnox at samba.org>
    Reviewed-by: Jose A. Rivera <jarrpa at samba.org>
    
    Autobuild-User(v4-2-test): Karolin Seeger <kseeger at samba.org>
    Autobuild-Date(v4-2-test): Mon Nov  2 13:57:12 CET 2015 on sn-devel-104

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

Summary of changes:
 ctdb/server/ctdb_server.c | 15 ++++++++++++++-
 ctdb/tools/ctdb.c         | 15 ++++++++++++++-
 2 files changed, 28 insertions(+), 2 deletions(-)


Changeset truncated at 500 lines:

diff --git a/ctdb/server/ctdb_server.c b/ctdb/server/ctdb_server.c
index 1e3fde4..b87f5ab 100644
--- a/ctdb/server/ctdb_server.c
+++ b/ctdb/server/ctdb_server.c
@@ -183,6 +183,7 @@ static int ctdb_set_nlist(struct ctdb_context *ctdb, const char *nlist)
 	num_present = 0;
 	for (i=0; i < nlines; i++) {
 		char *node;
+		size_t len;
 
 		node = lines[i];
 		/* strip leading spaces */
@@ -196,7 +197,19 @@ static int ctdb_set_nlist(struct ctdb_context *ctdb, const char *nlist)
 			}
 			continue;
 		}
-		if (strcmp(node, "") == 0) {
+
+		/* strip trailing spaces */
+
+		len = strlen(node);
+
+		while ((len > 1) &&
+		       ((node[len-1] == ' ') || (node[len-1] == '\t')))
+		{
+			node[len-1] = '\0';
+			len--;
+		}
+
+		if (len == 0) {
 			continue;
 		}
 		if (ctdb_add_node(ctdb, node) != 0) {
diff --git a/ctdb/tools/ctdb.c b/ctdb/tools/ctdb.c
index 6911dff..c4490ac 100644
--- a/ctdb/tools/ctdb.c
+++ b/ctdb/tools/ctdb.c
@@ -870,6 +870,7 @@ static struct pnn_node *read_pnn_node_file(TALLOC_CTX *mem_ctx,
 	}
 	for (i=0, pnn=0; i<nlines; i++) {
 		char *node;
+		size_t len;
 
 		node = lines[i];
 		/* strip leading spaces */
@@ -880,7 +881,19 @@ static struct pnn_node *read_pnn_node_file(TALLOC_CTX *mem_ctx,
 			pnn++;
 			continue;
 		}
-		if (strcmp(node, "") == 0) {
+
+		/* strip trailing spaces */
+
+		len = strlen(node);
+
+		while ((len > 1) &&
+		       ((node[len-1] == ' ') || (node[len-1] == '\t')))
+		{
+			node[len-1] = '\0';
+			len--;
+		}
+
+		if (len == 0) {
 			continue;
 		}
 		pnn_node = talloc(mem_ctx, struct pnn_node);


-- 
Samba Shared Repository



More information about the samba-cvs mailing list