1
0
mirror of https://github.com/samba-team/samba.git synced 2025-03-27 22:50:26 +03:00

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
This commit is contained in:
Michael Adam 2015-06-26 16:24:55 +02:00 committed by Volker Lendecke
parent c5be94c5da
commit 15ac12af9c

View File

@ -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;
}