The branch, master has been updated via a0561c7ed44 ctdb-tests: Rename local-daemon.sh dump-logs to print-log via e0b33c5549f ctdb-build: Tweak hacking of rpcgen output via 755a9e654fe ctdb-daemon: Don't check if lock_ctx->ctdb_db is NULL via e5a946cba5c ctdb-common: Mark ctdb_fatal() and ctdb_die() as _NORETURN_ via ba95cb2ae15 ctdb-event: Fix signed/unsigned comparisons by casting via 5527f3922fd ctdb-database: Fix signed/unsigned comparison by casting via e7b586f711f ctdb-event: Assign missing return value via d424d2197f1 ctdb-common: Fix signed/unsigned comparisons by declaring as unsigned via 271d96e4fca ctdb-common: Fix error handling via 0ab5d5cece2 ctdb-common: Fix signed/unsigned comparisons by casting via 79a7cc3fb97 ctdb-daemon: Drop unused function ctdb_vfork_with_logging() via 2a933859979 ctdb-protocol: Avoid signed/unsigned comparison by casting via 3f388076203 ctdb-protocol: Variable for return value of strlcpy() should be size_t via 248d585ab42 ctdb-protocol: Fix signed/unsigned comparison by declaring as unsigned via 4f84aafa61c ctdb-protocol: Do not ignore return value of ctdb_g_lock_pull() via 75a808fd86a ctdb-daemon: Don't index by PNN when initialising node flags via 010c1d77cd7 ctdb-daemon: Replace function ctdb_ip_to_nodeid() with ctdb_ip_to_pnn() via 888ecc74ed1 ctdb-tcp: Fix signed/unsigned comparisons by declaring as unsigned via 75747c6106f ctdb-tests: Avoid warning about NULL dereference via d855dc2a5fa ctdb-tests: Don't compare an unsigned value with -1 via 5d8531b05c4 ctdb-tests: Fix signed/unsigned comparisons by casting via 68a4588a6fb ctdb-tests: Fix signed/unsigned comparisons by declaring as unsigned via c172e0ef2e7 ctdb-tests: Fix signed/unsigned comparisons by casting via f749356d949 ctdb-tests: Add a local variable for repeated calculation via 6053bf4bab4 ctdb-tests: Declare variable for return value of write(2) as ssize_t via 914e6b210fb ctdb-tests: Fix signed/unsigned comparison by declaring as unsigned via 4c24d434b96 ctdb-cluster-mutex: Ensure that the configured command is not empty via 9c75ad68189 ctdb-daemon: Drop unused values assigned to variable via c39441f62d9 ctdb-daemon: Fix signed/unsigned comparisons by using constant via 76e930d784e ctdb-daemon: Fix signed/unsigned comparisons by casting via 1e47a1b3f6a ctdb-daemon: Fix signed/unsigned comparisons by declaring as unsigned via 3ccce53e3e6 ctdb-daemon: Make type of list_of_nodes() consistent with callers via 65563479013 ctdb-daemon: Make old list_of_nodes() function static via 6478d65a2f1 ctdb-tools: Drop separate parallel+verbose stdout/stderr filtering via f3feb4df3a9 ctdb-tools: Drop no-op stdout-filter from non-parallel case via 90de5e0594b ctdb-tools: Drop onnode -o option from b1fc6e435b4 s3:tests: Add test for manual smbtorture zero-data
https://git.samba.org/?p=samba.git;a=shortlog;h=master - Log ----------------------------------------------------------------- commit a0561c7ed44afcc978f940a7936a210f37baf273 Author: Martin Schwenke <mar...@meltin.net> Date: Mon Jul 1 07:04:19 2019 +1000 ctdb-tests: Rename local-daemon.sh dump-logs to print-log This makes it consistent with print-socket. Signed-off-by: Martin Schwenke <mar...@meltin.net> Reviewed-by: Amitay Isaacs <ami...@gmail.com> Autobuild-User(master): Amitay Isaacs <ami...@samba.org> Autobuild-Date(master): Fri Jul 5 06:19:11 UTC 2019 on sn-devel-184 commit e0b33c5549ffb1a06270af5e2b4a199496add90d Author: Martin Schwenke <mar...@meltin.net> Date: Tue Jun 25 10:03:44 2019 +1000 ctdb-build: Tweak hacking of rpcgen output csbuild doesn't like the hack where variable buf is initialised to itself to avoid an unused variable warning. buf is unused so remove it instead. Signed-off-by: Martin Schwenke <mar...@meltin.net> Reviewed-by: Amitay Isaacs <ami...@gmail.com> commit 755a9e654feaa7265975a1f02ea2f59fd30d09a9 Author: Martin Schwenke <mar...@meltin.net> Date: Tue Jun 25 06:35:04 2019 +1000 ctdb-daemon: Don't check if lock_ctx->ctdb_db is NULL This can never be NULL. It could probably be NULL in the past when "all database" locks existed. There are paths where is is checked for NULL and then later dereferenced, causing static analysers to produce spurious warnings. Signed-off-by: Martin Schwenke <mar...@meltin.net> Reviewed-by: Amitay Isaacs <ami...@gmail.com> commit e5a946cba5c309a6bdd1109685866d4a1c6841be Author: Martin Schwenke <mar...@meltin.net> Date: Mon Jun 24 17:01:07 2019 +1000 ctdb-common: Mark ctdb_fatal() and ctdb_die() as _NORETURN_ This avoids static analysers continuing analysis after calls to these functions and producing incorrect warnings. Signed-off-by: Martin Schwenke <mar...@meltin.net> Reviewed-by: Amitay Isaacs <ami...@gmail.com> commit ba95cb2ae1564edc27541c2a87e35f338e4653f7 Author: Martin Schwenke <mar...@meltin.net> Date: Mon Jun 24 16:45:06 2019 +1000 ctdb-event: Fix signed/unsigned comparisons by casting Signed-off-by: Martin Schwenke <mar...@meltin.net> Reviewed-by: Amitay Isaacs <ami...@gmail.com> commit 5527f3922fd680a9bd8330434a0c4221f35e51aa Author: Martin Schwenke <mar...@meltin.net> Date: Mon Jun 24 16:44:37 2019 +1000 ctdb-database: Fix signed/unsigned comparison by casting Signed-off-by: Martin Schwenke <mar...@meltin.net> Reviewed-by: Amitay Isaacs <ami...@gmail.com> commit e7b586f711f739cf50e9a623c683b23856266eed Author: Martin Schwenke <mar...@meltin.net> Date: Mon Jun 24 16:42:58 2019 +1000 ctdb-event: Assign missing return value Otherwise ret == 0 is returned from successful call to ctdb_int32_pull(). Signed-off-by: Martin Schwenke <mar...@meltin.net> Reviewed-by: Amitay Isaacs <ami...@gmail.com> commit d424d2197f1f873fded84ed650295d0b8c64960a Author: Martin Schwenke <mar...@meltin.net> Date: Mon Jun 24 16:42:21 2019 +1000 ctdb-common: Fix signed/unsigned comparisons by declaring as unsigned Signed-off-by: Martin Schwenke <mar...@meltin.net> Reviewed-by: Amitay Isaacs <ami...@gmail.com> commit 271d96e4fcae7228e460cba558041f4656588f22 Author: Martin Schwenke <mar...@meltin.net> Date: Mon Jun 24 16:36:47 2019 +1000 ctdb-common: Fix error handling According to the documentation, sendto() should either send the packet as given or return with an error. However, given that it can return the number of bytes sent, treat the theoretical error of a short packet send separately, since errno would not be set in this case. Similarly, treat a short packet recv() separately from an error where errno is set. Signed-off-by: Martin Schwenke <mar...@meltin.net> Reviewed-by: Amitay Isaacs <ami...@gmail.com> commit 0ab5d5cece2b7d22cabfffd090cf3c675dca4af5 Author: Martin Schwenke <mar...@meltin.net> Date: Mon Jun 24 16:35:01 2019 +1000 ctdb-common: Fix signed/unsigned comparisons by casting One case needs an extra variable declared. Signed-off-by: Martin Schwenke <mar...@meltin.net> Reviewed-by: Amitay Isaacs <ami...@gmail.com> commit 79a7cc3fb976c88a57099fdae239ddd217bcc968 Author: Martin Schwenke <mar...@meltin.net> Date: Mon Jun 24 14:02:53 2019 +1000 ctdb-daemon: Drop unused function ctdb_vfork_with_logging() Signed-off-by: Martin Schwenke <mar...@meltin.net> Reviewed-by: Amitay Isaacs <ami...@gmail.com> commit 2a93385997912c89fa6b547f8c32fa67283403cb Author: Martin Schwenke <mar...@meltin.net> Date: Sun Jun 23 21:00:38 2019 +1000 ctdb-protocol: Avoid signed/unsigned comparison by casting Signed-off-by: Martin Schwenke <mar...@meltin.net> Reviewed-by: Amitay Isaacs <ami...@gmail.com> commit 3f388076203c5d3c77ebb66e10d4c2bd6b7cedc7 Author: Martin Schwenke <mar...@meltin.net> Date: Sun Jun 23 20:59:34 2019 +1000 ctdb-protocol: Variable for return value of strlcpy() should be size_t This avoids an unnecessary signed/unsigned comparison issue. Signed-off-by: Martin Schwenke <mar...@meltin.net> Reviewed-by: Amitay Isaacs <ami...@gmail.com> commit 248d585ab420ef837001fa9a882101b209bae7d3 Author: Martin Schwenke <mar...@meltin.net> Date: Wed Jun 26 16:14:28 2019 +1000 ctdb-protocol: Fix signed/unsigned comparison by declaring as unsigned Signed-off-by: Martin Schwenke <mar...@meltin.net> Reviewed-by: Amitay Isaacs <ami...@gmail.com> commit 4f84aafa61cad21ba77b86f3341c09e0314e8b47 Author: Martin Schwenke <mar...@meltin.net> Date: Sat Jun 8 00:04:31 2019 +1000 ctdb-protocol: Do not ignore return value of ctdb_g_lock_pull() clang reports: ctdb/protocol/protocol_types.c:5191:3: warning: Value stored to 'ret' is never read Found by csbuild. Signed-off-by: Martin Schwenke <mar...@meltin.net> Reviewed-by: Amitay Isaacs <ami...@gmail.com> commit 75a808fd86a58371b465332f7c9d47d2dfbcbc08 Author: Martin Schwenke <mar...@meltin.net> Date: Sat Jun 22 06:23:12 2019 +1000 ctdb-daemon: Don't index by PNN when initialising node flags Indexing by PNN is wrong. This also removes a signed/unsigned comparison because the PNN is not compared to -1 anymore. Signed-off-by: Martin Schwenke <mar...@meltin.net> Reviewed-by: Amitay Isaacs <ami...@gmail.com> commit 010c1d77cd7e192b1fff39b7b91fccbdbbf4a786 Author: Martin Schwenke <mar...@meltin.net> Date: Sat Jun 22 05:53:15 2019 +1000 ctdb-daemon: Replace function ctdb_ip_to_nodeid() with ctdb_ip_to_pnn() Node ID is a poorly defined concept, indicating the slot in the node map where the IP address was found. This signed value also ends up compared to num_nodes, which is unsigned, producing unwanted warnings. Just return the PNN because this what both callers really want. Signed-off-by: Martin Schwenke <mar...@meltin.net> Reviewed-by: Amitay Isaacs <ami...@gmail.com> commit 888ecc74ed1a6617b8a0a4450b671cf5f6d88f8b Author: Martin Schwenke <mar...@meltin.net> Date: Sat Jun 22 05:29:53 2019 +1000 ctdb-tcp: Fix signed/unsigned comparisons by declaring as unsigned Signed-off-by: Martin Schwenke <mar...@meltin.net> Reviewed-by: Amitay Isaacs <ami...@gmail.com> commit 75747c6106fa2a966686f7a523cdb9d28708b870 Author: Martin Schwenke <mar...@meltin.net> Date: Fri Jun 21 16:08:58 2019 +1000 ctdb-tests: Avoid warning about NULL dereference Static analysis finds that earlier in the call path, ctdb_string_len() checks for NULL, so complains that a NULL value can be passed to strlen() here. Avoid this by adding an assert(). Signed-off-by: Martin Schwenke <mar...@meltin.net> Reviewed-by: Amitay Isaacs <ami...@gmail.com> commit d855dc2a5faff1eafec287fa8748000d21949684 Author: Martin Schwenke <mar...@meltin.net> Date: Fri Jun 21 14:41:38 2019 +1000 ctdb-tests: Don't compare an unsigned value with -1 The dummy reader should never be called, so contains an assert on the buffer length that should always trigger. Just abort() instead. Signed-off-by: Martin Schwenke <mar...@meltin.net> Reviewed-by: Amitay Isaacs <ami...@gmail.com> commit 5d8531b05c4112cd5d4f7d192d591fdb102241d6 Author: Martin Schwenke <mar...@meltin.net> Date: Fri Jun 21 14:39:20 2019 +1000 ctdb-tests: Fix signed/unsigned comparisons by casting These are all cases comparing a number of bytes written (int or ssize_t) with a size_t, so casting to size_t is appropriate. Signed-off-by: Martin Schwenke <mar...@meltin.net> Reviewed-by: Amitay Isaacs <ami...@gmail.com> commit 68a4588a6fb4c77c6dd34f5d98643525e169c32c Author: Martin Schwenke <mar...@meltin.net> Date: Fri Jun 21 14:37:11 2019 +1000 ctdb-tests: Fix signed/unsigned comparisons by declaring as unsigned Change declarations of variable and parameters, usually loop variables and limits, from int to unsigned int, size_t or uint32_t. Signed-off-by: Martin Schwenke <mar...@meltin.net> Reviewed-by: Amitay Isaacs <ami...@gmail.com> commit c172e0ef2e70a80ee362c760a8f644e6d62c2d8e Author: Martin Schwenke <mar...@meltin.net> Date: Wed Jun 26 15:59:10 2019 +1000 ctdb-tests: Fix signed/unsigned comparisons by casting Signed-off-by: Martin Schwenke <mar...@meltin.net> Reviewed-by: Amitay Isaacs <ami...@gmail.com> commit f749356d9494ecbc2d6f50dd5706b29c00f67d7a Author: Martin Schwenke <mar...@meltin.net> Date: Fri Jun 21 21:16:18 2019 +1000 ctdb-tests: Add a local variable for repeated calculation This improves readability. Also, the asserts involving this expression get more complicated in the next commit, so this will keep those asserts within a single line. Signed-off-by: Martin Schwenke <mar...@meltin.net> Reviewed-by: Amitay Isaacs <ami...@gmail.com> commit 6053bf4bab4cfc01129c52352fd23cea501ab98c Author: Martin Schwenke <mar...@meltin.net> Date: Fri Jun 21 21:47:06 2019 +1000 ctdb-tests: Declare variable for return value of write(2) as ssize_t Signed-off-by: Martin Schwenke <mar...@meltin.net> Reviewed-by: Amitay Isaacs <ami...@gmail.com> commit 914e6b210fb213306a9b7222f4bb01e2cf2be29b Author: Martin Schwenke <mar...@meltin.net> Date: Wed Jun 26 15:55:41 2019 +1000 ctdb-tests: Fix signed/unsigned comparison by declaring as unsigned Signed-off-by: Martin Schwenke <mar...@meltin.net> Reviewed-by: Amitay Isaacs <ami...@gmail.com> commit 4c24d434b9610e2865f8288e8046588cd8c551e6 Author: Martin Schwenke <mar...@meltin.net> Date: Sat Jun 8 06:56:00 2019 +1000 ctdb-cluster-mutex: Ensure that the configured command is not empty ... and does not just contain whitespace. Otherwise NULL can be passed as the first argument to execv(). Signed-off-by: Martin Schwenke <mar...@meltin.net> Reviewed-by: Amitay Isaacs <ami...@gmail.com> commit 9c75ad68189b258de1224f99b4f1a07409ec4084 Author: Martin Schwenke <mar...@meltin.net> Date: Sat Jun 8 06:41:15 2019 +1000 ctdb-daemon: Drop unused values assigned to variable Signed-off-by: Martin Schwenke <mar...@meltin.net> Reviewed-by: Amitay Isaacs <ami...@gmail.com> commit c39441f62d9a05d2a329dd43a17e51374293de90 Author: Martin Schwenke <mar...@meltin.net> Date: Sat Jun 8 06:40:40 2019 +1000 ctdb-daemon: Fix signed/unsigned comparisons by using constant Signed-off-by: Martin Schwenke <mar...@meltin.net> Reviewed-by: Amitay Isaacs <ami...@gmail.com> commit 76e930d784e3ea4d8f2076ffc0035a12500db260 Author: Martin Schwenke <mar...@meltin.net> Date: Sat Jun 8 06:40:12 2019 +1000 ctdb-daemon: Fix signed/unsigned comparisons by casting Signed-off-by: Martin Schwenke <mar...@meltin.net> Reviewed-by: Amitay Isaacs <ami...@gmail.com> commit 1e47a1b3f6ab1e2ad9d86dfb28c3e086c99a97e5 Author: Martin Schwenke <mar...@meltin.net> Date: Sat Jun 8 06:38:56 2019 +1000 ctdb-daemon: Fix signed/unsigned comparisons by declaring as unsigned Signed-off-by: Martin Schwenke <mar...@meltin.net> Reviewed-by: Amitay Isaacs <ami...@gmail.com> commit 3ccce53e3e6ebb5f7f628bd1b18b7152f548dd27 Author: Martin Schwenke <mar...@meltin.net> Date: Sat Jun 8 06:22:49 2019 +1000 ctdb-daemon: Make type of list_of_nodes() consistent with callers Instead of taking exclude_pnn as a parameter, calculate it from an include_self_parameter, which is passed through from the 2 calling functions. While doing this, fix a signed/unsigned comparison issue by declaring the new exclude_pnn local variable as an unsigned type. Signed-off-by: Martin Schwenke <mar...@meltin.net> Reviewed-by: Amitay Isaacs <ami...@gmail.com> commit 655634790139b08a5093dc3851dee208d13f7294 Author: Martin Schwenke <mar...@meltin.net> Date: Sat Jun 8 06:08:48 2019 +1000 ctdb-daemon: Make old list_of_nodes() function static The next commit will change the type of this function, which is only used in this file. So, make it static to isolate the change. Signed-off-by: Martin Schwenke <mar...@meltin.net> Reviewed-by: Amitay Isaacs <ami...@gmail.com> commit 6478d65a2f1bc79040753f4dae952c638fcb64e2 Author: Martin Schwenke <mar...@meltin.net> Date: Fri Jun 28 15:46:57 2019 +1000 ctdb-tools: Drop separate parallel+verbose stdout/stderr filtering This has been broken for 10 years since commit 9616959bd6938e4c5c3713fe986c1e17cbdc574c, which introduced the separate filtering. This commit was missing a redirect of the output of stderr_filter() to stderr. Since nobody depends on the separate filtering (i.e. nobody reported a bug), just return to combining stdout and stderr, and filtering them together. Signed-off-by: Martin Schwenke <mar...@meltin.net> Reviewed-by: Amitay Isaacs <ami...@gmail.com> commit f3feb4df3a90bd40998fa60887a56961954f6423 Author: Martin Schwenke <mar...@meltin.net> Date: Fri Jun 28 15:44:59 2019 +1000 ctdb-tools: Drop no-op stdout-filter from non-parallel case This filter no longer does anything useful in this context. By default it adds a pipeline with trailing cat process. In many contexts, stdout of the process being run is still open so the cat process will stay around and will stop onnode from exiting. The filters should all go away because they are simply an example of code that is trying to be too clever while causing unfortunate corner cases. Signed-off-by: Martin Schwenke <mar...@meltin.net> Reviewed-by: Amitay Isaacs <ami...@gmail.com> commit 90de5e0594b9180226b9a13293afe31f18576b3d Author: Martin Schwenke <mar...@meltin.net> Date: Fri Jun 28 15:43:27 2019 +1000 ctdb-tools: Drop onnode -o option I don't think anyone uses this and it causes complications. Signed-off-by: Martin Schwenke <mar...@meltin.net> Reviewed-by: Amitay Isaacs <ami...@gmail.com> ----------------------------------------------------------------------- Summary of changes: ctdb/common/common.h | 6 +- ctdb/common/ctdb_ltdb.c | 8 +-- ctdb/common/ctdb_util.c | 5 +- ctdb/common/event_script.c | 4 +- ctdb/common/run_event.c | 2 +- ctdb/common/sock_io.c | 2 +- ctdb/common/system_socket.c | 18 ++++-- ctdb/database/database_conf.c | 2 +- ctdb/doc/onnode.1.xml | 9 --- ctdb/event/event_conf.c | 2 +- ctdb/event/event_protocol.c | 1 + ctdb/event/event_tool.c | 2 +- ctdb/include/ctdb_client.h | 3 - ctdb/include/ctdb_private.h | 15 +---- ctdb/protocol/protocol_types.c | 21 ++++--- ctdb/protocol/protocol_util.c | 6 +- ctdb/server/ctdb_client.c | 39 +++++++----- ctdb/server/ctdb_cluster_mutex.c | 4 ++ ctdb/server/ctdb_daemon.c | 34 +++++----- ctdb/server/ctdb_freeze.c | 10 +-- ctdb/server/ctdb_keepalive.c | 2 +- ctdb/server/ctdb_lock.c | 49 +++++---------- ctdb/server/ctdb_lock_helper.c | 3 +- ctdb/server/ctdb_logging.c | 96 ----------------------------- ctdb/server/ctdb_ltdb_server.c | 2 +- ctdb/server/ctdb_persistent.c | 2 +- ctdb/server/ctdb_server.c | 24 ++++---- ctdb/server/ctdb_takeover.c | 25 +++++--- ctdb/server/ctdb_takeover_helper.c | 10 ++- ctdb/server/ctdb_traverse.c | 2 +- ctdb/server/ctdb_update_record.c | 9 ++- ctdb/server/ctdb_vacuum.c | 4 +- ctdb/server/eventscript.c | 2 +- ctdb/tcp/tcp_connect.c | 13 ++-- ctdb/tcp/tcp_init.c | 4 +- ctdb/tests/local_daemons.sh | 8 +-- ctdb/tests/src/cluster_wait.c | 6 +- ctdb/tests/src/cluster_wait.h | 2 +- ctdb/tests/src/comm_client_test.c | 7 ++- ctdb/tests/src/comm_test.c | 6 +- ctdb/tests/src/conf_test.c | 2 +- ctdb/tests/src/ctdb_io_test.c | 61 +++++++++--------- ctdb/tests/src/ctdb_packet_parse.c | 2 +- ctdb/tests/src/errcode.c | 6 +- ctdb/tests/src/event_script_test.c | 3 +- ctdb/tests/src/fake_ctdbd.c | 19 +++--- ctdb/tests/src/fetch_ring.c | 6 +- ctdb/tests/src/line_test.c | 2 +- ctdb/tests/src/pkt_write_test.c | 2 +- ctdb/tests/src/protocol_basic_test.c | 3 +- ctdb/tests/src/protocol_common.c | 36 +++++------ ctdb/tests/src/protocol_common_basic.c | 4 +- ctdb/tests/src/protocol_ctdb_compat_test.c | 2 +- ctdb/tests/src/protocol_ctdb_test.c | 2 +- ctdb/tests/src/protocol_types_compat_test.c | 29 +++++---- ctdb/tests/src/run_event_test.c | 6 +- ctdb/tests/src/sigcode.c | 6 +- ctdb/tests/src/sock_io_test.c | 4 +- ctdb/tests/src/system_socket_test.c | 4 +- ctdb/tools/onnode | 43 ++----------- ctdb/wscript | 2 +- 61 files changed, 300 insertions(+), 413 deletions(-) Changeset truncated at 500 lines: diff --git a/ctdb/common/common.h b/ctdb/common/common.h index 6b2c98ef383..79f6b9ed03a 100644 --- a/ctdb/common/common.h +++ b/ctdb/common/common.h @@ -20,6 +20,8 @@ #ifndef __CTDB_COMMON_H__ #define __CTDB_COMMON_H__ +#include "lib/util/attr.h" + /* From common/ctdb_io.c */ typedef void (*ctdb_queue_cb_fn_t)(uint8_t *data, size_t length, @@ -91,9 +93,9 @@ const char *ctdb_errstr(struct ctdb_context *ctdb); void ctdb_set_error(struct ctdb_context *ctdb, const char *fmt, ...) PRINTF_ATTRIBUTE(2,3); -void ctdb_fatal(struct ctdb_context *ctdb, const char *msg); +void ctdb_fatal(struct ctdb_context *ctdb, const char *msg) _NORETURN_; -void ctdb_die(struct ctdb_context *ctdb, const char *msg); +void ctdb_die(struct ctdb_context *ctdb, const char *msg) _NORETURN_; bool ctdb_set_helper(const char *type, char *helper, size_t size, const char *envvar, diff --git a/ctdb/common/ctdb_ltdb.c b/ctdb/common/ctdb_ltdb.c index 1fc9ce28c1b..73458754def 100644 --- a/ctdb/common/ctdb_ltdb.c +++ b/ctdb/common/ctdb_ltdb.c @@ -308,8 +308,8 @@ int ctdb_ltdb_delete(struct ctdb_db_context *ctdb_db, TDB_DATA key) int ctdb_trackingdb_add_pnn(struct ctdb_context *ctdb, TDB_DATA *data, uint32_t pnn) { - int byte_pos = pnn / 8; - int bit_mask = 1 << (pnn % 8); + unsigned int byte_pos = pnn / 8; + unsigned char bit_mask = 1 << (pnn % 8); if (byte_pos + 1 > data->dsize) { char *buf; @@ -334,10 +334,10 @@ int ctdb_trackingdb_add_pnn(struct ctdb_context *ctdb, TDB_DATA *data, uint32_t void ctdb_trackingdb_traverse(struct ctdb_context *ctdb, TDB_DATA data, ctdb_trackingdb_cb cb, void *private_data) { - int i; + unsigned int i; for(i = 0; i < data.dsize; i++) { - int j; + unsigned int j; for (j=0; j<8; j++) { int mask = 1<<j; diff --git a/ctdb/common/ctdb_util.c b/ctdb/common/ctdb_util.c index 0f367c2100e..3f8fff925f0 100644 --- a/ctdb/common/ctdb_util.c +++ b/ctdb/common/ctdb_util.c @@ -111,7 +111,10 @@ bool ctdb_set_helper(const char *type, char *helper, size_t size, ("Unable to set %s - dir is NULL\n", type)); return false; } else { - if (snprintf(helper, size, "%s/%s", dir, file) >= size) { + int ret; + + ret = snprintf(helper, size, "%s/%s", dir, file); + if (ret < 0 || (size_t)ret >= size) { DEBUG(DEBUG_ERR, ("Unable to set %s - path too long\n", type)); return false; diff --git a/ctdb/common/event_script.c b/ctdb/common/event_script.c index 8bdfdd0b5ca..edd607f7a14 100644 --- a/ctdb/common/event_script.c +++ b/ctdb/common/event_script.c @@ -159,7 +159,7 @@ int event_script_chmod(const char *script_dir, script_file = script_name; } else { ret = snprintf(buf, sizeof(buf), "%s.script", script_name); - if (ret >= sizeof(buf)) { + if (ret < 0 || (size_t)ret >= sizeof(buf)) { return ENAMETOOLONG; } script_file = buf; @@ -196,7 +196,7 @@ int event_script_chmod(const char *script_dir, "%s/%s", script_dir, script_file); - if (ret >= sizeof(filename)) { + if (ret < 0 || (size_t)ret >= sizeof(filename)) { return ENAMETOOLONG; } diff --git a/ctdb/common/run_event.c b/ctdb/common/run_event.c index ca4e572a806..d283664e2cf 100644 --- a/ctdb/common/run_event.c +++ b/ctdb/common/run_event.c @@ -519,7 +519,7 @@ struct run_event_state { struct run_event_script_list *script_list; const char **argv; struct tevent_req *script_subreq; - int index; + unsigned int index; bool cancelled; }; diff --git a/ctdb/common/sock_io.c b/ctdb/common/sock_io.c index b5c9332526b..81e82c59ca0 100644 --- a/ctdb/common/sock_io.c +++ b/ctdb/common/sock_io.c @@ -198,7 +198,7 @@ static void sock_queue_handler(struct tevent_context *ev, goto fail; } - if (num_ready > queue->buflen - queue->end) { + if ((size_t)num_ready > queue->buflen - queue->end) { queue->buf = talloc_realloc_size(queue, queue->buf, queue->end + num_ready); if (queue->buf == NULL) { diff --git a/ctdb/common/system_socket.c b/ctdb/common/system_socket.c index c6800431112..86cbdaab6ad 100644 --- a/ctdb/common/system_socket.c +++ b/ctdb/common/system_socket.c @@ -681,10 +681,14 @@ int ctdb_sys_send_tcp(const ctdb_sock_addr *dest, sizeof(dest->ip)); saved_errno = errno; close(s); - if (ret != len) { + if (ret == -1) { D_ERR("Failed sendto (%s)\n", strerror(saved_errno)); return -1; } + if ((size_t)ret != len) { + DBG_ERR("Failed sendto - didn't send full packet\n"); + return -1; + } break; case AF_INET6: @@ -722,11 +726,14 @@ int ctdb_sys_send_tcp(const ctdb_sock_addr *dest, sizeof(tmpdest)); saved_errno = errno; close(s); - - if (ret != len) { + if (ret == -1) { D_ERR("Failed sendto (%s)\n", strerror(saved_errno)); return -1; } + if ((size_t)ret != len) { + DBG_ERR("Failed sendto - didn't send full packet\n"); + return -1; + } break; default: @@ -914,7 +921,10 @@ int ctdb_sys_read_tcp_packet(int s, void *private_data, int ret; nread = recv(s, pkt, sizeof(pkt), MSG_TRUNC); - if (nread < sizeof(*eth)) { + if (nread == -1) { + return errno; + } + if ((size_t)nread < sizeof(*eth)) { return EMSGSIZE; } diff --git a/ctdb/database/database_conf.c b/ctdb/database/database_conf.c index 6bdb372bf03..4c7cb2d9ffe 100644 --- a/ctdb/database/database_conf.c +++ b/ctdb/database/database_conf.c @@ -96,7 +96,7 @@ static bool database_conf_validate_lock_debug_script(const char *key, "%s/%s", path_etcdir(), basename(script)); - if (ret >= sizeof(script_path)) { + if (ret < 0 || (size_t)ret >= sizeof(script_path)) { D_ERR("lock debug script path too long\n"); return false; } diff --git a/ctdb/doc/onnode.1.xml b/ctdb/doc/onnode.1.xml index c9d56a97dd5..f7da04aedbe 100644 --- a/ctdb/doc/onnode.1.xml +++ b/ctdb/doc/onnode.1.xml @@ -90,15 +90,6 @@ </listitem> </varlistentry> - <varlistentry><term>-o <parameter>PREFIX</parameter></term> - <listitem> - <para> - Causes standard output from each node to be saved into a - file with name PREFIX.<replaceable>IP</replaceable>. - </para> - </listitem> - </varlistentry> - <varlistentry><term>-p</term> <listitem> <para> diff --git a/ctdb/event/event_conf.c b/ctdb/event/event_conf.c index 33bfc7c5335..61ecf8e33eb 100644 --- a/ctdb/event/event_conf.c +++ b/ctdb/event/event_conf.c @@ -50,7 +50,7 @@ static bool event_conf_validate_debug_script(const char *key, "%s/%s", path_etcdir(), basename(script)); - if (ret >= sizeof(script_path)) { + if (ret < 0 || (size_t)ret >= sizeof(script_path)) { D_ERR("debug script path too long\n"); return false; } diff --git a/ctdb/event/event_protocol.c b/ctdb/event/event_protocol.c index 21adb430c20..baa9e1ecb82 100644 --- a/ctdb/event/event_protocol.c +++ b/ctdb/event/event_protocol.c @@ -317,6 +317,7 @@ static int ctdb_event_script_list_pull(uint8_t *buf, value->script = talloc_array(value, struct ctdb_event_script, num_scripts); if (value->script == NULL) { + ret = ENOMEM; goto fail; } diff --git a/ctdb/event/event_tool.c b/ctdb/event/event_tool.c index 6cc5dc9a822..9c95e6d9553 100644 --- a/ctdb/event/event_tool.c +++ b/ctdb/event/event_tool.c @@ -408,7 +408,7 @@ static int event_command_script_list(TALLOC_CTX *mem_ctx, } len = readlink(e->path, buf, sizeof(buf)); - if (len == -1 || len >= sizeof(buf)) { + if (len == -1 || (size_t)len >= sizeof(buf)) { /* * Not a link? Disappeared? Invalid * link target? Something else? diff --git a/ctdb/include/ctdb_client.h b/ctdb/include/ctdb_client.h index a48e506d271..ef4950ab533 100644 --- a/ctdb/include/ctdb_client.h +++ b/ctdb/include/ctdb_client.h @@ -278,9 +278,6 @@ uint32_t *list_of_vnnmap_nodes(struct ctdb_context *ctdb, struct ctdb_vnn_map *vnn_map, TALLOC_CTX *mem_ctx, bool include_self); -uint32_t *list_of_nodes(struct ctdb_context *ctdb, - struct ctdb_node_map_old *node_map, - TALLOC_CTX *mem_ctx, uint32_t mask, int exclude_pnn); uint32_t *list_of_active_nodes(struct ctdb_context *ctdb, struct ctdb_node_map_old *node_map, TALLOC_CTX *mem_ctx, bool include_self); diff --git a/ctdb/include/ctdb_private.h b/ctdb/include/ctdb_private.h index ea00bb12128..2bcc7c94156 100644 --- a/ctdb/include/ctdb_private.h +++ b/ctdb/include/ctdb_private.h @@ -675,16 +675,6 @@ struct lock_request *ctdb_lock_db(TALLOC_CTX *mem_ctx, bool ctdb_logging_init(TALLOC_CTX *mem_ctx, const char *logging, const char *debug_level); -struct ctdb_log_state *ctdb_vfork_with_logging(TALLOC_CTX *mem_ctx, - struct ctdb_context *ctdb, - const char *log_prefix, - const char *helper, - int helper_argc, - const char **helper_argv, - void (*logfn)(const char *, - uint16_t, void *), - void *logfn_private, pid_t *pid); - int ctdb_set_child_logging(struct ctdb_context *ctdb); /* from ctdb_logging_file.c */ @@ -713,7 +703,7 @@ int ctdb_load_persistent_health(struct ctdb_context *ctdb, int ctdb_update_persistent_health(struct ctdb_context *ctdb, struct ctdb_db_context *ctdb_db, const char *reason,/* NULL means healthy */ - int num_healthy_nodes); + unsigned int num_healthy_nodes); int ctdb_recheck_persistent_health(struct ctdb_context *ctdb); int32_t ctdb_control_db_set_healthy(struct ctdb_context *ctdb, @@ -841,7 +831,8 @@ void ctdb_stop_recoverd(struct ctdb_context *ctdb); int ctdb_set_transport(struct ctdb_context *ctdb, const char *transport); -int ctdb_ip_to_nodeid(struct ctdb_context *ctdb, const ctdb_sock_addr *nodeip); +uint32_t ctdb_ip_to_pnn(struct ctdb_context *ctdb, + const ctdb_sock_addr *nodeip); void ctdb_load_nodes_file(struct ctdb_context *ctdb); diff --git a/ctdb/protocol/protocol_types.c b/ctdb/protocol/protocol_types.c index 416d4843b74..d9388b74b1e 100644 --- a/ctdb/protocol/protocol_types.c +++ b/ctdb/protocol/protocol_types.c @@ -1640,7 +1640,8 @@ int ctdb_rec_buffer_traverse(struct ctdb_rec_buffer *recbuf, TDB_DATA key, data; uint32_t reqid; size_t offset, reclen; - int ret = 0, i; + unsigned int i; + int ret = 0; offset = 0; for (i=0; i<recbuf->count; i++) { @@ -1679,19 +1680,19 @@ int ctdb_rec_buffer_write(struct ctdb_rec_buffer *recbuf, int fd) ssize_t n; n = write(fd, &recbuf->db_id, sizeof(uint32_t)); - if (n == -1 || n != sizeof(uint32_t)) { + if (n == -1 || (size_t)n != sizeof(uint32_t)) { return (errno != 0 ? errno : EIO); } n = write(fd, &recbuf->count, sizeof(uint32_t)); - if (n == -1 || n != sizeof(uint32_t)) { + if (n == -1 || (size_t)n != sizeof(uint32_t)) { return (errno != 0 ? errno : EIO); } n = write(fd, &recbuf->buflen, sizeof(size_t)); - if (n == -1 || n != sizeof(size_t)) { + if (n == -1 || (size_t)n != sizeof(size_t)) { return (errno != 0 ? errno : EIO); } n = write(fd, recbuf->buf, recbuf->buflen); - if (n == -1 || n != recbuf->buflen) { + if (n == -1 || (size_t)n != recbuf->buflen) { return (errno != 0 ? errno : EIO); } @@ -1710,15 +1711,15 @@ int ctdb_rec_buffer_read(int fd, TALLOC_CTX *mem_ctx, } n = read(fd, &recbuf->db_id, sizeof(uint32_t)); - if (n == -1 || n != sizeof(uint32_t)) { + if (n == -1 || (size_t)n != sizeof(uint32_t)) { return (errno != 0 ? errno : EIO); } n = read(fd, &recbuf->count, sizeof(uint32_t)); - if (n == -1 || n != sizeof(uint32_t)) { + if (n == -1 || (size_t)n != sizeof(uint32_t)) { return (errno != 0 ? errno : EIO); } n = read(fd, &recbuf->buflen, sizeof(size_t)); - if (n == -1 || n != sizeof(size_t)) { + if (n == -1 || (size_t)n != sizeof(size_t)) { return (errno != 0 ? errno : EIO); } @@ -1728,7 +1729,7 @@ int ctdb_rec_buffer_read(int fd, TALLOC_CTX *mem_ctx, } n = read(fd, recbuf->buf, recbuf->buflen); - if (n == -1 || n != recbuf->buflen) { + if (n == -1 || (size_t)n != recbuf->buflen) { return (errno != 0 ? errno : EIO); } @@ -5208,5 +5209,5 @@ done: fail: talloc_free(val); - return ENOMEM; + return ret; } diff --git a/ctdb/protocol/protocol_util.c b/ctdb/protocol/protocol_util.c index 2a0d42a9f45..c67aa2e056f 100644 --- a/ctdb/protocol/protocol_util.c +++ b/ctdb/protocol/protocol_util.c @@ -147,7 +147,7 @@ int ctdb_sock_addr_to_buf(char *buf, socklen_t buflen, ret = snprintf(buf+len, buflen-len, ":%u", ctdb_sock_addr_port(addr)); - if (ret >= buflen-len) { + if (ret < 0 || (size_t)ret >= buflen-len) { return ENOSPC; } } @@ -311,7 +311,7 @@ int ctdb_sock_addr_mask_from_string(const char *str, char *p; char s[64]; /* Much longer than INET6_ADDRSTRLEN */ unsigned int m; - ssize_t len; + size_t len; int ret = 0; if (addr == NULL || mask == NULL) { @@ -485,7 +485,7 @@ int ctdb_connection_to_buf(char *buf, size_t buflen, } else { ret = snprintf(buf, buflen, "%s %s", client, server); } - if (ret >= buflen) { + if (ret < 0 || (size_t)ret >= buflen) { return ENOSPC; } diff --git a/ctdb/server/ctdb_client.c b/ctdb/server/ctdb_client.c index f66ecbea7c1..dc7836abb2e 100644 --- a/ctdb/server/ctdb_client.c +++ b/ctdb/server/ctdb_client.c @@ -97,7 +97,9 @@ int ctdb_call_local(struct ctdb_db_context *ctdb_db, struct ctdb_call *call, c->header = header; for (fn=ctdb_db->calls;fn;fn=fn->next) { - if (fn->id == call->call_id) break; + if (fn->id == (uint32_t)call->call_id) { + break; + } } if (fn == NULL) { ctdb_set_error(ctdb, "Unknown call id %u\n", call->call_id); @@ -1746,7 +1748,7 @@ uint32_t *list_of_vnnmap_nodes(struct ctdb_context *ctdb, TALLOC_CTX *mem_ctx, bool include_self) { - int i, j, num_nodes; + unsigned int i, j, num_nodes; uint32_t *nodes; for (i=num_nodes=0;i<vnn_map->size;i++) { @@ -1769,18 +1771,19 @@ uint32_t *list_of_vnnmap_nodes(struct ctdb_context *ctdb, return nodes; } -/* Get list of nodes not including those with flags specified by mask. - * If exclude_pnn is not -1 then exclude that pnn from the list. - */ -uint32_t *list_of_nodes(struct ctdb_context *ctdb, - struct ctdb_node_map_old *node_map, - TALLOC_CTX *mem_ctx, - uint32_t mask, - int exclude_pnn) +/* Get list of nodes not including those with flags specified by mask */ +static uint32_t *list_of_nodes(struct ctdb_context *ctdb, + struct ctdb_node_map_old *node_map, + TALLOC_CTX *mem_ctx, + uint32_t mask, + bool include_self) { - int i, j, num_nodes; + unsigned int i, j, num_nodes; + uint32_t exclude_pnn; uint32_t *nodes; + exclude_pnn = include_self ? CTDB_UNKNOWN_PNN : ctdb->pnn; + for (i=num_nodes=0;i<node_map->num;i++) { if (node_map->nodes[i].flags & mask) { continue; @@ -1812,8 +1815,11 @@ uint32_t *list_of_active_nodes(struct ctdb_context *ctdb, TALLOC_CTX *mem_ctx, bool include_self) { - return list_of_nodes(ctdb, node_map, mem_ctx, NODE_FLAGS_INACTIVE, - include_self ? -1 : ctdb->pnn); + return list_of_nodes(ctdb, + node_map, + mem_ctx, + NODE_FLAGS_INACTIVE, + include_self); } uint32_t *list_of_connected_nodes(struct ctdb_context *ctdb, @@ -1821,8 +1827,11 @@ uint32_t *list_of_connected_nodes(struct ctdb_context *ctdb, TALLOC_CTX *mem_ctx, bool include_self) { - return list_of_nodes(ctdb, node_map, mem_ctx, NODE_FLAGS_DISCONNECTED, - include_self ? -1 : ctdb->pnn); + return list_of_nodes(ctdb, + node_map, + mem_ctx, + NODE_FLAGS_DISCONNECTED, + include_self); } /* diff --git a/ctdb/server/ctdb_cluster_mutex.c b/ctdb/server/ctdb_cluster_mutex.c index 2e3cb8112ad..719b5c14f7a 100644 --- a/ctdb/server/ctdb_cluster_mutex.c +++ b/ctdb/server/ctdb_cluster_mutex.c @@ -176,6 +176,10 @@ static bool cluster_mutex_helper_args_cmd(TALLOC_CTX *mem_ctx, return false; } n = strv_count(strv); + if (n == 0) { + D_ERR("Mutex helper command is empty \"%s\"\n", argstring); + return false; + } /* Extra slot for NULL */ args = talloc_array(mem_ctx, char *, n + 1); diff --git a/ctdb/server/ctdb_daemon.c b/ctdb/server/ctdb_daemon.c index acb40bdb8df..c0553a18c14 100644 --- a/ctdb/server/ctdb_daemon.c +++ b/ctdb/server/ctdb_daemon.c @@ -1229,23 +1229,26 @@ failed: static void initialise_node_flags (struct ctdb_context *ctdb) { - if (ctdb->pnn == -1) { -- Samba Shared Repository