diff options
author | Martin Schwenke <martin@meltin.net> | 2019-07-03 20:58:54 +1000 |
---|---|---|
committer | Amitay Isaacs <amitay@samba.org> | 2019-07-05 06:49:16 +0000 |
commit | 753874b38fddc05357635e13c8ce26d319b0d77f (patch) | |
tree | 67b7e6fab380b6fc84ce7aff8d439c8968d0b838 /ctdb | |
parent | c5803507df7def388edcd5b6cbfee30cd217b536 (diff) | |
download | samba-753874b38fddc05357635e13c8ce26d319b0d77f.tar.gz |
ctdb-tools: CID 1449530 - Negative loop bound
Regression introduced by commit
2558f96da1f9be8034f26736c8050bb38a1f82a8. count should be signed
because list_of_connected_nodes() returns -1 on failure. Variable i
is used in both signed and unsigned contexts, so add new signed
variable j for use in signed context.
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
Diffstat (limited to 'ctdb')
-rw-r--r-- | ctdb/tools/ctdb.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/ctdb/tools/ctdb.c b/ctdb/tools/ctdb.c index 9d46c981a0f..2cc72eedc76 100644 --- a/ctdb/tools/ctdb.c +++ b/ctdb/tools/ctdb.c @@ -3657,7 +3657,8 @@ static int control_reloadnodes(TALLOC_CTX *mem_ctx, struct ctdb_context *ctdb, struct ctdb_req_control request; struct ctdb_reply_control **reply; bool reload; - unsigned int i, count; + unsigned int i; + int count; int ret; uint32_t *pnn_list; @@ -3726,13 +3727,14 @@ static int control_reloadnodes(TALLOC_CTX *mem_ctx, struct ctdb_context *ctdb, &request, NULL, &reply); if (ret != 0) { bool failed = false; + int j; - for (i=0; i<count; i++) { - ret = ctdb_reply_control_reload_nodes_file(reply[i]); + for (j=0; j<count; j++) { + ret = ctdb_reply_control_reload_nodes_file(reply[j]); if (ret != 0) { fprintf(stderr, "Node %u failed to reload nodes\n", - pnn_list[i]); + pnn_list[j]); failed = true; } } |