diff options
author | Michael Adam <obnox at samba.org> | 2015-06-26 16:24:55 +0200 |
---|---|---|
committer | Volker Lendecke <vl@samba.org> | 2015-06-27 13:20:18 +0200 |
commit | 15ac12af9c00adb05dcdfcb637777b503b87994b (patch) | |
tree | 83c151e7eb1a945733308c1cbe42400650235aab /ctdb | |
parent | c5be94c5da5ca9d6baf20632b884f2ee722b1d71 (diff) | |
download | samba-15ac12af9c00adb05dcdfcb637777b503b87994b.tar.gz |
ctdb: strip trailing spaces from nodes file.
Signed-off-by: Michael Adam <obnox at samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Sat Jun 27 13:20:18 CEST 2015 on sn-devel-104
Diffstat (limited to 'ctdb')
-rw-r--r-- | ctdb/common/ctdb_util.c | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/ctdb/common/ctdb_util.c b/ctdb/common/ctdb_util.c index 5d63c272926..709c7a15b6b 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; } |