[SCM] Samba Shared Repository - branch master updated

Amitay Isaacs amitay at samba.org
Wed Jun 5 12:10:02 UTC 2019


The branch, master has been updated
       via  952437b1bdb ctdb-utils: Fix CID 1125558 (Unchecked return value from library)
       via  b1d83fb3e88 ctdb-daemon: Attempt to silence CID 1357985 (Unchecked return value)
       via  aa602a8cc59 ctdb-cluster: CID 1435726: NULL pointer dereference
       via  2db0e71d3be ctdb-ipalloc: Fix warning about unused value assigned to srcimbl
       via  7df15b246ab ctdb-ipalloc: Avoid -1 as a PNN, use CTDB_UNKNOWN_PNN instead
       via  86666d6570f ctdb-ipalloc: Fix signed/unsigned comparisons by declaring as unsigned
       via  18b4a3a0d31 ctdb-tests: Avoid potentially uninitialised data
       via  0bd87d75c0d ctdb-utils: Avoid warning about unused value
       via  90622ab901a ctdb-recovery: Fix signed/unsigned comparisons by declaring as unsigned
       via  35368d871d9 ctdb-recovery: Avoid -1 as a PNN, use CTDB_UNKNOWN_PNN instead
       via  978c7dbd559 ctdb-recovery: Fix signed/unsigned comparison by casting
       via  fa7bd35b6ad ctdb-recovery: Fix signed/unsigned comparisons by declaring as unsigned
       via  7fa6c1206a3 ctdb-tests: Fix signed/unsigned comparison by using constant
       via  2c76a957c0e ctdb-client: Fix potentially uninitialised data
       via  2be15d3c61f ctdb-client: Fix signed/unsigned comparisons by declaring as unsigned
       via  887dc174f23 ctdb-common: Avoid unused value warning
       via  94e41a8466f ctdb-common: Avoid warning for potentially uninitialised pointers
       via  cf9199f425c ctdb-common: Use #ifdef to avoid TEST_RB_TREE not defined
       via  2b3150db944 ctdb-common: Fix signed/unsigned comparisons by casting
       via  5b9456b70b6 ctdb-common: Fix signed/unsigned comparisons by declaring as unsigned
       via  938df1dbc81 ctdb-tools: Fix potentially uninitialised data
       via  9869ac1fb76 ctdb-tools: Fix signed/unsigned conversion by declaring as size_t
       via  282221b0d64 ctdb-tools: Fix signed/unsigned comparison by declaring as int
       via  201066d2e63 ctdb-tools: Fix signed/unsigned comparison by declaring as unsigned
       via  4a8ca51997f ctdb-tools: Fix signed/unsigned comparisons by casting
       via  865f127e7d2 ctdb-tools: Fix signed/unsigned comparisons by declaring extra variable
       via  2558f96da1f ctdb-tools: Fix signed/unsigned comparisons by declaring as unsigned
      from  843fbb1207e ctdb-scripts: Fix tcp_tw_recycle existence check

https://git.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 952437b1bdbe000c217836c4ecd59406e92146d7
Author: Martin Schwenke <martin at meltin.net>
Date:   Wed May 29 19:11:51 2019 +1000

    ctdb-utils: Fix CID 1125558 (Unchecked return value from library)
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>
    
    Autobuild-User(master): Amitay Isaacs <amitay at samba.org>
    Autobuild-Date(master): Wed Jun  5 12:09:56 UTC 2019 on sn-devel-184

commit b1d83fb3e88acfdfe00f06e950185ed03fee624f
Author: Martin Schwenke <martin at meltin.net>
Date:   Wed May 29 19:05:49 2019 +1000

    ctdb-daemon: Attempt to silence CID 1357985 (Unchecked return value)
    
    Yes, the other callers check the return value of ctdb_lockdb_mark().
    However, this is called in a void function and ctdb_lockdb_mark() has
    already printed any error message.  All we can do is explicitly ignore
    the return value.
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>

commit aa602a8cc590dd416764d21147545bb411e47e35
Author: Martin Schwenke <martin at meltin.net>
Date:   Wed May 29 17:38:03 2019 +1000

    ctdb-cluster: CID 1435726: NULL pointer dereference
    
    Also found by csbuild.
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>

commit 2db0e71d3bef334dbb0a73f7118bf92af1cf0890
Author: Martin Schwenke <martin at meltin.net>
Date:   Thu May 30 15:41:42 2019 +1000

    ctdb-ipalloc: Fix warning about unused value assigned to srcimbl
    
    To make this much clearer, move the declaration into the scope where
    it is used.
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>

commit 7df15b246abb9ea2f606f5739a02cfec51f6d9cb
Author: Martin Schwenke <martin at meltin.net>
Date:   Thu May 30 15:40:42 2019 +1000

    ctdb-ipalloc: Avoid -1 as a PNN, use CTDB_UNKNOWN_PNN instead
    
    This fixes warnings about signed versus unsigned comparisons.
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>

commit 86666d6570f5377139a18d3e8875e89565bb8ee0
Author: Martin Schwenke <martin at meltin.net>
Date:   Thu May 30 15:37:38 2019 +1000

    ctdb-ipalloc: Fix signed/unsigned comparisons by declaring as unsigned
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>

commit 18b4a3a0d316954d65617ee189dffa9c4269f42e
Author: Martin Schwenke <martin at meltin.net>
Date:   Thu May 30 15:33:05 2019 +1000

    ctdb-tests: Avoid potentially uninitialised data
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>

commit 0bd87d75c0db076e17d2d186afbdccb3e769b125
Author: Martin Schwenke <martin at meltin.net>
Date:   Thu May 30 15:32:03 2019 +1000

    ctdb-utils: Avoid warning about unused value
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>

commit 90622ab901a2738c827d79c002123f758fb966b7
Author: Martin Schwenke <martin at meltin.net>
Date:   Sat May 25 22:04:10 2019 +1000

    ctdb-recovery: Fix signed/unsigned comparisons by declaring as unsigned
    
    Simple cases where variables and function parameters need to be
    declared as an unsigned type instead of an int.
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>

commit 35368d871d94a0f7bf74ac227a6f0b62bd6c8f1c
Author: Martin Schwenke <martin at meltin.net>
Date:   Thu May 23 17:50:32 2019 +1000

    ctdb-recovery: Avoid -1 as a PNN, use CTDB_UNKNOWN_PNN instead
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>

commit 978c7dbd55916460b993b26bc0d3457bf063a72f
Author: Martin Schwenke <martin at meltin.net>
Date:   Thu May 23 17:47:24 2019 +1000

    ctdb-recovery: Fix signed/unsigned comparison by casting
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>

commit fa7bd35b6ada0e33db9c6e883bf1ae92508e8e3b
Author: Martin Schwenke <martin at meltin.net>
Date:   Thu May 23 08:43:58 2019 +1000

    ctdb-recovery: Fix signed/unsigned comparisons by declaring as unsigned
    
    Simple cases where variables need to be declared as an unsigned type
    instead of an int.
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>

commit 7fa6c1206a3a5fa6961275743b4a31775c1d9faa
Author: Martin Schwenke <martin at meltin.net>
Date:   Wed May 22 21:58:46 2019 +1000

    ctdb-tests: Fix signed/unsigned comparison by using constant
    
    Variable reqid is unsigned, so don't compare with -1.
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>

commit 2c76a957c0e3a01c3571c67970dff29f9c31dfe4
Author: Martin Schwenke <martin at meltin.net>
Date:   Wed May 22 21:58:14 2019 +1000

    ctdb-client: Fix potentially uninitialised data
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>

commit 2be15d3c61f643666f9b3a845487125d801c134f
Author: Martin Schwenke <martin at meltin.net>
Date:   Wed May 22 21:55:56 2019 +1000

    ctdb-client: Fix signed/unsigned comparisons by declaring as unsigned
    
    Simple cases where a variables and function parameters need to be
    declared as an unsigned type instead of an int.
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>

commit 887dc174f2320de2318d8bd56f1b58c95c10519e
Author: Martin Schwenke <martin at meltin.net>
Date:   Thu May 23 17:53:19 2019 +1000

    ctdb-common: Avoid unused value warning
    
    The incremented value of argc is indeed never used.  Leave it as a
    comment to warn anyone cutting and pasting the code.
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>

commit 94e41a8466f024edb6eb069c0c5f8025599cf116
Author: Martin Schwenke <martin at meltin.net>
Date:   Thu May 23 17:51:46 2019 +1000

    ctdb-common: Avoid warning for potentially uninitialised pointers
    
    s_list generates a warning, but initialise them both.
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>

commit cf9199f425ce7f2412f794ebb89bb28f898571c7
Author: Martin Schwenke <martin at meltin.net>
Date:   Thu May 23 17:49:26 2019 +1000

    ctdb-common: Use #ifdef to avoid TEST_RB_TREE not defined
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>

commit 2b3150db944076f7dc4300bb73c766bf4d7517b1
Author: Martin Schwenke <martin at meltin.net>
Date:   Sun Jun 2 14:05:28 2019 +1000

    ctdb-common: Fix signed/unsigned comparisons by casting
    
    In one case, given triviality of change, add missing braces and fix
    whitespace.
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>

commit 5b9456b70b611e5f520bb90b9e807f6ddfb64c98
Author: Martin Schwenke <martin at meltin.net>
Date:   Wed May 22 21:55:18 2019 +1000

    ctdb-common: Fix signed/unsigned comparisons by declaring as unsigned
    
    Simple cases where a variable (usually a loop variable) needs to be
    declared as an unsigned type (unsigned int or size_t) instead of an
    int.
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>

commit 938df1dbc81bdba8d919e6a1410376ed836eb663
Author: Martin Schwenke <martin at meltin.net>
Date:   Wed May 22 21:57:43 2019 +1000

    ctdb-tools: Fix potentially uninitialised data
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>

commit 9869ac1fb7677267426979ab9dadefffe501b84c
Author: Martin Schwenke <martin at meltin.net>
Date:   Tue May 28 10:57:49 2019 +1000

    ctdb-tools: Fix signed/unsigned conversion by declaring as size_t
    
    All the top-level callers pass size_t.
    
    Drop the ternary operator.  The value of hsize is always positive
    because it is unsigned.
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>

commit 282221b0d64314f40b92651ffb41a95e01a1267a
Author: Martin Schwenke <martin at meltin.net>
Date:   Tue May 28 10:55:19 2019 +1000

    ctdb-tools: Fix signed/unsigned comparison by declaring as int
    
    There's no point using unsigned here.  tdb_traverse() returns an int
    for the number of records traversed and the number of empty records
    can't exceed this value.
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>

commit 201066d2e63c38485c3bad8f9f7c1bb53f0b9f65
Author: Martin Schwenke <martin at meltin.net>
Date:   Wed May 22 21:54:04 2019 +1000

    ctdb-tools: Fix signed/unsigned comparison by declaring as unsigned
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>

commit 4a8ca51997f411932fe3eec099cb296f35faff54
Author: Martin Schwenke <martin at meltin.net>
Date:   Wed May 22 21:57:07 2019 +1000

    ctdb-tools: Fix signed/unsigned comparisons by casting
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>

commit 865f127e7d29829da6c638ba13a034071ef14a6b
Author: Martin Schwenke <martin at meltin.net>
Date:   Fri May 24 13:50:07 2019 +1000

    ctdb-tools: Fix signed/unsigned comparisons by declaring extra variable
    
    This needs an extra variable because variable i has been used in both
    signed and unsigned contexts.
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>

commit 2558f96da1f9be8034f26736c8050bb38a1f82a8
Author: Martin Schwenke <martin at meltin.net>
Date:   Wed May 22 21:52:17 2019 +1000

    ctdb-tools: Fix signed/unsigned comparisons by declaring as unsigned
    
    These are the simple cases where a variable (usually a loop variable)
    needs to be declared as an unsigned type (usually unsigned int or
    size_t) instead of an int.
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>

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

Summary of changes:
 ctdb/client/client.h                   |   8 +-
 ctdb/client/client_db.c                |   7 +-
 ctdb/client/client_tunnel.c            |   8 +-
 ctdb/client/client_util.c              |   2 +-
 ctdb/cluster/cluster_conf.c            |  13 ++-
 ctdb/common/cmdline.c                  |   7 +-
 ctdb/common/logging.c                  |  20 ++---
 ctdb/common/path.c                     |   2 +-
 ctdb/common/rb_tree.c                  |   4 +-
 ctdb/common/run_event.c                |  11 +--
 ctdb/server/ctdb_lock.c                |   2 +-
 ctdb/server/ctdb_recover.c             |  10 ++-
 ctdb/server/ctdb_recoverd.c            |  46 ++++++-----
 ctdb/server/ctdb_recovery_helper.c     |  31 +++----
 ctdb/server/ipalloc.c                  |  14 ++--
 ctdb/server/ipalloc_common.c           |  21 ++---
 ctdb/server/ipalloc_lcp2.c             |  43 +++++-----
 ctdb/server/ipalloc_nondeterministic.c |  16 ++--
 ctdb/server/ipalloc_private.h          |   2 +-
 ctdb/tests/src/reqid_test.c            |   2 +-
 ctdb/tests/src/run_event_test.c        |   4 +-
 ctdb/tools/ctdb.c                      | 143 ++++++++++++++++++---------------
 ctdb/tools/ctdb_killtcp.c              |   3 +-
 ctdb/tools/ltdbtool.c                  |  13 +--
 ctdb/utils/ping_pong/ping_pong.c       |  12 ++-
 25 files changed, 252 insertions(+), 192 deletions(-)


Changeset truncated at 500 lines:

diff --git a/ctdb/client/client.h b/ctdb/client/client.h
index d4d145045e0..0df76a66e46 100644
--- a/ctdb/client/client.h
+++ b/ctdb/client/client.h
@@ -691,7 +691,7 @@ int ctdb_tunnel_destroy(struct tevent_context *ev,
 struct tevent_req *ctdb_tunnel_request_send(TALLOC_CTX *mem_ctx,
 					    struct tevent_context *ev,
 					    struct ctdb_tunnel_context *tctx,
-					    int destnode,
+					    uint32_t destnode,
 					    struct timeval timeout,
 					    uint8_t *buf, size_t buflen,
 					    bool wait_for_reply);
@@ -724,7 +724,7 @@ bool ctdb_tunnel_request_recv(struct tevent_req *req, int *perr,
  * @return 0 on success, errno on failure
  */
 int ctdb_tunnel_request(TALLOC_CTX *mem_ctx, struct tevent_context *ev,
-			struct ctdb_tunnel_context *tctx, int destnode,
+			struct ctdb_tunnel_context *tctx, uint32_t destnode,
 			struct timeval timeout, uint8_t *buf, size_t buflen,
 			bool wait_for_reply);
 
@@ -744,7 +744,7 @@ int ctdb_tunnel_request(TALLOC_CTX *mem_ctx, struct tevent_context *ev,
 struct tevent_req *ctdb_tunnel_reply_send(TALLOC_CTX *mem_ctx,
 					  struct tevent_context *ev,
 					  struct ctdb_tunnel_context *tctx,
-					  int destnode, uint32_t reqid,
+					  uint32_t destnode, uint32_t reqid,
 					  struct timeval timeout,
 					  uint8_t *buf, size_t buflen);
 
@@ -771,7 +771,7 @@ bool ctdb_tunnel_reply_recv(struct tevent_req *req, int *perr);
  * @return 0 on success, errno on failure
  */
 int ctdb_tunnel_reply(TALLOC_CTX *mem_ctx, struct tevent_context *ev,
-		      struct ctdb_tunnel_context *tctx, int destnode,
+		      struct ctdb_tunnel_context *tctx, uint32_t destnode,
 		      uint32_t reqid, struct timeval timeout,
 		      uint8_t *buf, size_t buflen);
 
diff --git a/ctdb/client/client_db.c b/ctdb/client/client_db.c
index c0ecdeb2d30..dfa8d970de5 100644
--- a/ctdb/client/client_db.c
+++ b/ctdb/client/client_db.c
@@ -1442,7 +1442,7 @@ int ctdb_fetch_lock(TALLOC_CTX *mem_ctx, struct tevent_context *ev,
 {
 	struct tevent_req *req;
 	struct ctdb_record_handle *h;
-	int ret;
+	int ret = 0;
 
 	req = ctdb_fetch_lock_send(mem_ctx, ev, client, db, key, readonly);
 	if (req == NULL) {
@@ -2018,7 +2018,8 @@ static int ctdb_g_lock_unlock_update(struct tevent_req *req)
 	struct ctdb_g_lock_unlock_state *state = tevent_req_data(
 		req, struct ctdb_g_lock_unlock_state);
 	struct ctdb_g_lock *lock;
-	int ret, i;
+	unsigned int i;
+	int ret;
 
 	for (i=0; i<state->lock_list->num; i++) {
 		lock = &state->lock_list->lock[i];
@@ -2248,7 +2249,7 @@ int ctdb_transaction_start(TALLOC_CTX *mem_ctx, struct tevent_context *ev,
 {
 	struct tevent_req *req;
 	struct ctdb_transaction_handle *h;
-	int ret;
+	int ret = 0;
 
 	req = ctdb_transaction_start_send(mem_ctx, ev, client, timeout, db,
 					  readonly);
diff --git a/ctdb/client/client_tunnel.c b/ctdb/client/client_tunnel.c
index a783afe47c8..13c35fb61be 100644
--- a/ctdb/client/client_tunnel.c
+++ b/ctdb/client/client_tunnel.c
@@ -392,7 +392,7 @@ static void ctdb_tunnel_request_done(struct tevent_req *subreq);
 struct tevent_req *ctdb_tunnel_request_send(TALLOC_CTX *mem_ctx,
 					    struct tevent_context *ev,
 					    struct ctdb_tunnel_context *tctx,
-					    int destnode,
+					    uint32_t destnode,
 					    struct timeval timeout,
 					    uint8_t *buf, size_t buflen,
 					    bool wait_for_reply)
@@ -544,7 +544,7 @@ bool ctdb_tunnel_request_recv(struct tevent_req *req, int *perr,
 }
 
 int ctdb_tunnel_request(TALLOC_CTX *mem_ctx, struct tevent_context *ev,
-			struct ctdb_tunnel_context *tctx, int destnode,
+			struct ctdb_tunnel_context *tctx, uint32_t destnode,
 			struct timeval timeout, uint8_t *buf, size_t buflen,
 			bool wait_for_reply)
 {
@@ -577,7 +577,7 @@ static void ctdb_tunnel_reply_done(struct tevent_req *subreq);
 struct tevent_req *ctdb_tunnel_reply_send(TALLOC_CTX *mem_ctx,
 					  struct tevent_context *ev,
 					  struct ctdb_tunnel_context *tctx,
-					  int destnode, uint32_t reqid,
+					  uint32_t destnode, uint32_t reqid,
 					  struct timeval timeout,
 					  uint8_t *buf, size_t buflen)
 {
@@ -667,7 +667,7 @@ bool ctdb_tunnel_reply_recv(struct tevent_req *req, int *perr)
 }
 
 int ctdb_tunnel_reply(TALLOC_CTX *mem_ctx, struct tevent_context *ev,
-		      struct ctdb_tunnel_context *tctx, int destnode,
+		      struct ctdb_tunnel_context *tctx, uint32_t destnode,
 		      uint32_t reqid, struct timeval timeout,
 		      uint8_t *buf, size_t buflen)
 {
diff --git a/ctdb/client/client_util.c b/ctdb/client/client_util.c
index c68135f0af9..35323ff9eac 100644
--- a/ctdb/client/client_util.c
+++ b/ctdb/client/client_util.c
@@ -41,7 +41,7 @@ int list_of_nodes(struct ctdb_node_map *nodemap,
 {
 	int num_nodes = 0;
 	uint32_t *list;
-	int i;
+	unsigned int i;
 
 	/* Allocate the list of same number of nodes */
 	list = talloc_array(mem_ctx, uint32_t, nodemap->num);
diff --git a/ctdb/cluster/cluster_conf.c b/ctdb/cluster/cluster_conf.c
index 540732d5b91..be79d5942a8 100644
--- a/ctdb/cluster/cluster_conf.c
+++ b/ctdb/cluster/cluster_conf.c
@@ -38,13 +38,24 @@ static bool check_static_string_change(const char *key,
 				       enum conf_update_mode mode)
 {
 	if (mode == CONF_MODE_RELOAD) {
-		if (strcmp(old_value, new_value) != 0) {
+		if (old_value == new_value) {
+			goto done;
+		}
+
+		/*
+		 * At this point old_value or new_value can not both
+		 * NULL, so if one is NULL then they are different
+		 */
+		if (old_value == NULL ||
+		    new_value == NULL ||
+		    strcmp(old_value, new_value) != 0) {
 			D_WARNING("Ignoring update of [%s] -> %s\n",
 				  CLUSTER_CONF_SECTION,
 				  key);
 		}
 	}
 
+done:
 	return true;
 }
 
diff --git a/ctdb/common/cmdline.c b/ctdb/common/cmdline.c
index ee360d4c920..f3768c068fe 100644
--- a/ctdb/common/cmdline.c
+++ b/ctdb/common/cmdline.c
@@ -143,7 +143,7 @@ static int cmdline_options_define(TALLOC_CTX *mem_ctx,
 	return 0;
 }
 
-static bool cmdline_command_check(struct cmdline_command *cmd, int *max_len)
+static bool cmdline_command_check(struct cmdline_command *cmd, size_t *max_len)
 {
 	size_t len;
 
@@ -185,7 +185,7 @@ static bool cmdline_command_check(struct cmdline_command *cmd, int *max_len)
 }
 
 static bool cmdline_commands_check(struct cmdline_command *commands,
-				   int *max_len)
+				   size_t *max_len)
 {
 	int i;
 	bool ok;
@@ -213,7 +213,8 @@ int cmdline_init(TALLOC_CTX *mem_ctx,
 		 struct cmdline_context **result)
 {
 	struct cmdline_context *cmdline;
-	int ret, max_len = 0;
+	int ret;
+	size_t max_len = 0;
 	bool ok;
 
 	if (prog == NULL) {
diff --git a/ctdb/common/logging.c b/ctdb/common/logging.c
index 7ed500aeb0b..a4321b68ba9 100644
--- a/ctdb/common/logging.c
+++ b/ctdb/common/logging.c
@@ -54,7 +54,7 @@ struct {
 
 bool debug_level_parse(const char *log_string, int *log_level)
 {
-	int i;
+	size_t i;
 
 	if (log_string == NULL) {
 		return false;
@@ -63,7 +63,7 @@ bool debug_level_parse(const char *log_string, int *log_level)
 	if (isdigit(log_string[0])) {
 		int level = atoi(log_string);
 
-		if (level >= 0 && level < ARRAY_SIZE(log_string_map)) {
+		if (level >= 0 && (size_t)level < ARRAY_SIZE(log_string_map)) {
 			*log_level = level;
 			return true;
 		}
@@ -83,7 +83,7 @@ bool debug_level_parse(const char *log_string, int *log_level)
 
 const char *debug_level_to_string(int log_level)
 {
-	int i;
+	size_t i;
 
 	for (i=0; i < ARRAY_SIZE(log_string_map); i++) {
 		if (log_string_map[i].log_level == log_level) {
@@ -253,12 +253,12 @@ static int debug_level_to_priority(int level)
         };
         int priority;
 
-        if( level >= ARRAY_SIZE(priority_map) || level < 0)
-                priority = LOG_DEBUG;
-        else
-                priority = priority_map[level];
-
-        return priority;
+	if ((size_t)level >= ARRAY_SIZE(priority_map) || level < 0) {
+		priority = LOG_DEBUG;
+	} else {
+		priority = priority_map[level];
+	}
+	return priority;
 }
 
 struct syslog_log_state {
@@ -604,7 +604,7 @@ static int log_backend_parse(TALLOC_CTX *mem_ctx,
 {
 	struct log_backend *b = NULL;
 	char *t, *name, *option;
-	int i;
+	size_t i;
 
 	t = talloc_strdup(mem_ctx, logging);
 	if (t == NULL) {
diff --git a/ctdb/common/path.c b/ctdb/common/path.c
index 69e606b4ede..ea3b08f4b2e 100644
--- a/ctdb/common/path.c
+++ b/ctdb/common/path.c
@@ -89,7 +89,7 @@ static bool path_construct(char *path, const char *subdir)
 			       subdir);
 	}
 
-	if (len >= sizeof(p)) {
+	if ((size_t)len >= sizeof(p)) {
 		return false;
 	}
 
diff --git a/ctdb/common/rb_tree.c b/ctdb/common/rb_tree.c
index bacdea6c689..d94d15efd74 100644
--- a/ctdb/common/rb_tree.c
+++ b/ctdb/common/rb_tree.c
@@ -1029,7 +1029,7 @@ trbt_findfirstarray32(trbt_tree_t *tree, uint32_t keylen)
 }
 
 
-#if TEST_RB_TREE
+#ifdef TEST_RB_TREE
 static void printtree(trbt_node_t *node, int levels)
 {
 	int i;
@@ -1098,4 +1098,4 @@ exit(0);
 
 }
 
-#endif
+#endif /* TEST_RB_TREE */
diff --git a/ctdb/common/run_event.c b/ctdb/common/run_event.c
index 91b3dd3241a..ca4e572a806 100644
--- a/ctdb/common/run_event.c
+++ b/ctdb/common/run_event.c
@@ -101,7 +101,7 @@ static int script_args(TALLOC_CTX *mem_ctx, const char *event_str,
 		       const char *arg_str, const char ***out)
 {
 	const char **argv;
-	int argc;
+	size_t argc;
 	size_t len;
 
 	/* Preallocate argv array to avoid reallocation. */
@@ -146,7 +146,7 @@ static int script_args(TALLOC_CTX *mem_ctx, const char *event_str,
 	}
 
 	argv[argc] = NULL;
-	argc += 1;
+	/* argc += 1 */
 
 	*out = argv;
 	return 0;
@@ -285,9 +285,10 @@ int run_event_list(struct run_event_context *run_ctx,
 		   TALLOC_CTX *mem_ctx,
 		   struct run_event_script_list **output)
 {
-	struct event_script_list *s_list;
-	struct run_event_script_list *script_list;
-	int ret, i;
+	struct event_script_list *s_list = NULL;
+	struct run_event_script_list *script_list = NULL;
+	unsigned int i;
+	int ret;
 
 	ret = event_script_get_list(mem_ctx,
 				    run_event_script_dir(run_ctx),
diff --git a/ctdb/server/ctdb_lock.c b/ctdb/server/ctdb_lock.c
index a559e244471..d42d47af85f 100644
--- a/ctdb/server/ctdb_lock.c
+++ b/ctdb/server/ctdb_lock.c
@@ -255,7 +255,7 @@ static void process_callbacks(struct lock_context *lock_ctx, bool locked)
 			break;
 
 		case LOCK_DB:
-			ctdb_lockdb_mark(lock_ctx->ctdb_db);
+			(void)ctdb_lockdb_mark(lock_ctx->ctdb_db);
 			break;
 		}
 	}
diff --git a/ctdb/server/ctdb_recover.c b/ctdb/server/ctdb_recover.c
index cfe77f643a6..343728839c1 100644
--- a/ctdb/server/ctdb_recover.c
+++ b/ctdb/server/ctdb_recover.c
@@ -144,7 +144,7 @@ ctdb_control_getnodemap(struct ctdb_context *ctdb, uint32_t opcode, TDB_DATA ind
 int
 ctdb_control_reload_nodes_file(struct ctdb_context *ctdb, uint32_t opcode)
 {
-	int i, num_nodes;
+	unsigned int i, num_nodes;
 	TALLOC_CTX *tmp_ctx;
 	struct ctdb_node **nodes;
 
@@ -453,7 +453,8 @@ int32_t ctdb_control_push_db(struct ctdb_context *ctdb, TDB_DATA indata)
 {
 	struct ctdb_marshall_buffer *reply = (struct ctdb_marshall_buffer *)indata.dptr;
 	struct ctdb_db_context *ctdb_db;
-	int i, ret;
+	unsigned int i;
+	int ret;
 	struct ctdb_rec_data_old *rec;
 
 	if (indata.dsize < offsetof(struct ctdb_marshall_buffer, data)) {
@@ -554,7 +555,8 @@ static void db_push_msg_handler(uint64_t srvid, TDB_DATA indata,
 		private_data, struct db_push_state);
 	struct ctdb_marshall_buffer *recs;
 	struct ctdb_rec_data_old *rec;
-	int i, ret;
+	unsigned int i;
+	int ret;
 
 	if (state->failed) {
 		return;
@@ -1255,7 +1257,7 @@ int32_t ctdb_control_try_delete_records(struct ctdb_context *ctdb, TDB_DATA inda
 {
 	struct ctdb_marshall_buffer *reply = (struct ctdb_marshall_buffer *)indata.dptr;
 	struct ctdb_db_context *ctdb_db;
-	int i;
+	unsigned int i;
 	struct ctdb_rec_data_old *rec;
 	struct ctdb_marshall_buffer *records;
 
diff --git a/ctdb/server/ctdb_recoverd.c b/ctdb/server/ctdb_recoverd.c
index 3e63bd1e7a5..652bf9ce4ea 100644
--- a/ctdb/server/ctdb_recoverd.c
+++ b/ctdb/server/ctdb_recoverd.c
@@ -430,7 +430,8 @@ static int set_recovery_mode(struct ctdb_context *ctdb,
 static int create_missing_remote_databases(struct ctdb_context *ctdb, struct ctdb_node_map_old *nodemap, 
 					   uint32_t pnn, struct ctdb_dbid_map_old *dbmap, TALLOC_CTX *mem_ctx)
 {
-	int i, j, db, ret;
+	unsigned int i, j, db;
+	int ret;
 	struct ctdb_dbid_map_old *remote_dbmap;
 
 	/* verify that all other nodes have all our databases */
@@ -494,7 +495,8 @@ static int create_missing_remote_databases(struct ctdb_context *ctdb, struct ctd
 static int create_missing_local_databases(struct ctdb_context *ctdb, struct ctdb_node_map_old *nodemap, 
 					  uint32_t pnn, struct ctdb_dbid_map_old **dbmap, TALLOC_CTX *mem_ctx)
 {
-	int i, j, db, ret;
+	unsigned int i, j, db;
+	int ret;
 	struct ctdb_dbid_map_old *remote_dbmap;
 
 	/* verify that we have all database any other node has */
@@ -654,7 +656,8 @@ static void vacuum_fetch_handler(uint64_t srvid, TDB_DATA data,
 		private_data, struct ctdb_recoverd);
 	struct ctdb_context *ctdb = rec->ctdb;
 	struct ctdb_marshall_buffer *recs;
-	int ret, i;
+	unsigned int i;
+	int ret;
 	TALLOC_CTX *tmp_ctx = talloc_new(ctdb);
 	const char *name;
 	struct ctdb_dbid_map_old *dbmap=NULL;
@@ -805,7 +808,7 @@ static void ctdb_wait_election(struct ctdb_recoverd *rec)
  */
 static int update_local_flags(struct ctdb_recoverd *rec, struct ctdb_node_map_old *nodemap)
 {
-	int j;
+	unsigned int j;
 	struct ctdb_context *ctdb = rec->ctdb;
 	TALLOC_CTX *mem_ctx = talloc_new(ctdb);
 
@@ -1027,7 +1030,7 @@ static void ctdb_recovery_unlock(struct ctdb_recoverd *rec)
 static void ban_misbehaving_nodes(struct ctdb_recoverd *rec, bool *self_ban)
 {
 	struct ctdb_context *ctdb = rec->ctdb;
-	int i;
+	unsigned int i;
 	struct ctdb_banning_state *ban_state;
 
 	*self_ban = false;
@@ -1184,7 +1187,8 @@ static int ctdb_takeover(struct ctdb_recoverd *rec,
 {
 	static char prog[PATH_MAX+1] = "";
 	char *arg;
-	int i, ret;
+	unsigned int i;
+	int ret;
 
 	if (!ctdb_set_helper("takeover_helper", prog, sizeof(prog),
 			     "CTDB_TAKEOVER_HELPER", CTDB_HELPER_BINDIR,
@@ -1223,7 +1227,7 @@ static bool do_takeover_run(struct ctdb_recoverd *rec,
 	uint32_t *nodes = NULL;
 	struct ctdb_disable_message dtr;
 	TDB_DATA data;
-	int i;
+	size_t i;
 	uint32_t *rebalance_nodes = rec->force_rebalance_nodes;
 	int ret;
 	bool ok;
@@ -1335,7 +1339,8 @@ static int do_recovery(struct ctdb_recoverd *rec,
 		       struct ctdb_node_map_old *nodemap, struct ctdb_vnn_map *vnnmap)
 {
 	struct ctdb_context *ctdb = rec->ctdb;
-	int i, ret;
+	unsigned int i;
+	int ret;
 	struct ctdb_dbid_map_old *dbmap;
 	bool self_ban;
 
@@ -1542,7 +1547,8 @@ struct election_message {
  */
 static void ctdb_election_data(struct ctdb_recoverd *rec, struct election_message *em)
 {
-	int ret, i;
+	unsigned int i;
+	int ret;
 	struct ctdb_node_map_old *nodemap;
 	struct ctdb_context *ctdb = rec->ctdb;
 
@@ -2049,7 +2055,7 @@ static void monitor_handler(uint64_t srvid, TDB_DATA data, void *private_data)
 	struct ctdb_node_flag_change *c = (struct ctdb_node_flag_change *)data.dptr;
 	struct ctdb_node_map_old *nodemap=NULL;
 	TALLOC_CTX *tmp_ctx;
-	int i;
+	unsigned int i;
 
 	if (data.dsize != sizeof(*c)) {
 		DEBUG(DEBUG_ERR,(__location__ "Invalid data in ctdb_node_flag_change\n"));
@@ -2175,8 +2181,8 @@ static enum monitor_result verify_recmode(struct ctdb_context *ctdb, struct ctdb
 	TALLOC_CTX *mem_ctx = talloc_new(ctdb);
 	struct ctdb_client_control_state *state;
 	enum monitor_result status;
-	int j;
-	
+	unsigned int j;
+
 	rmdata = talloc(mem_ctx, struct verify_recmode_normal_data);
 	CTDB_NO_MEMORY_FATAL(ctdb, rmdata);
 	rmdata->count  = 0;
@@ -2250,7 +2256,7 @@ static void verify_recmaster_callback(struct ctdb_client_control_state *state)
 	/* if we got a response, then the recmaster will be stored in the
 	   status field
 	*/
-	if (state->status != rmdata->pnn) {
+	if ((uint32_t)state->status != rmdata->pnn) {
 		DEBUG(DEBUG_ERR,("Node %d thinks node %d is recmaster. Need a new recmaster election\n", state->c->hdr.destnode, state->status));
 		ctdb_set_culprit(rmdata->rec, state->c->hdr.destnode);
 		rmdata->status = MONITOR_ELECTION_NEEDED;
@@ -2268,8 +2274,8 @@ static enum monitor_result verify_recmaster(struct ctdb_recoverd *rec, struct ct
 	TALLOC_CTX *mem_ctx = talloc_new(ctdb);
 	struct ctdb_client_control_state *state;
 	enum monitor_result status;
-	int j;
-	
+	unsigned int j;
+
 	rmdata = talloc(mem_ctx, struct verify_recmaster_data);
 	CTDB_NO_MEMORY_FATAL(ctdb, rmdata);
 	rmdata->rec    = rec;


-- 
Samba Shared Repository



More information about the samba-cvs mailing list