The Samba-Bugzilla – Attachment 11550 Details for
Bug 11365
CTDB should ignore trailing spaces in nodes file
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch for v4-2-test backported from master
bug11365.v4-2-test.patch (text/plain), 2.12 KB, created by
Michael Adam
on 2015-10-28 19:09:16 UTC
(
hide
)
Description:
Patch for v4-2-test backported from master
Filename:
MIME Type:
Creator:
Michael Adam
Created:
2015-10-28 19:09:16 UTC
Size:
2.12 KB
patch
obsolete
>From dd3b8b59a31a813cbf96e50a03d0bcdbf77330e0 Mon Sep 17 00:00:00 2001 >From: Michael Adam <obnox@samba.org> >Date: Wed, 28 Oct 2015 19:39:41 +0100 >Subject: [PATCH] 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@samba.org> >Reviewed-by: Jose A. Rivera <jarrpa@samba.org> >--- > ctdb/server/ctdb_server.c | 15 ++++++++++++++- > ctdb/tools/ctdb.c | 15 ++++++++++++++- > 2 files changed, 28 insertions(+), 2 deletions(-) > >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); >-- >2.4.3 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Flags:
obnox
:
review+
jarrpa
:
review+
Actions:
View
Attachments on
bug 11365
: 11550