From 3e6656a4875b3480b44d5558f90e94cad7e928e3 Mon Sep 17 00:00:00 2001 From: Amitay Isaacs Date: Tue, 2 Aug 2016 18:31:14 +1000 Subject: [PATCH 1/6] ctdb-common: Fix format-nonliteral warning BUG: https://bugzilla.samba.org/show_bug.cgi?id=12137 Signed-off-by: Amitay Isaacs Reviewed-by: Uri Simchoni (cherry picked from commit b201859372189b6e7d57e078a813861a1533aaf4) --- ctdb/common/common.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ctdb/common/common.h b/ctdb/common/common.h index b89a84c..113816d 100644 --- a/ctdb/common/common.h +++ b/ctdb/common/common.h @@ -76,7 +76,8 @@ int ctdb_fetch_with_header_func(struct ctdb_call_info *call); const char *ctdb_errstr(struct ctdb_context *ctdb); -void ctdb_set_error(struct ctdb_context *ctdb, const char *fmt, ...); +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); -- 2.7.4 From 9849ff73067da28d64ca5ac49e1b3e0b2561f1b1 Mon Sep 17 00:00:00 2001 From: Amitay Isaacs Date: Tue, 2 Aug 2016 18:54:31 +1000 Subject: [PATCH 2/6] ctdb-daemon: Fix format-nonliteral warning BUG: https://bugzilla.samba.org/show_bug.cgi?id=12137 Signed-off-by: Amitay Isaacs Reviewed-by: Uri Simchoni (cherry picked from commit d682ee99810caac489c20d8b673ff4b12a17d75f) --- ctdb/include/ctdb_private.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ctdb/include/ctdb_private.h b/ctdb/include/ctdb_private.h index cf30efd..59af296 100644 --- a/ctdb/include/ctdb_private.h +++ b/ctdb/include/ctdb_private.h @@ -601,7 +601,7 @@ int ctdb_control_getnodesfile(struct ctdb_context *ctdb, uint32_t opcode, void ctdb_shutdown_sequence(struct ctdb_context *ctdb, int exit_code); int switch_from_server_to_client(struct ctdb_context *ctdb, - const char *fmt, ...); + const char *fmt, ...) PRINTF_ATTRIBUTE(2,3); /* From server/ctdb_fork.c */ -- 2.7.4 From ee31f038626d9362c95bcc3b204609efeca65cf2 Mon Sep 17 00:00:00 2001 From: Amitay Isaacs Date: Tue, 2 Aug 2016 18:58:51 +1000 Subject: [PATCH 3/6] ctdb-daemon: Fix format-nonliteral warning BUG: https://bugzilla.samba.org/show_bug.cgi?id=12137 Signed-off-by: Amitay Isaacs Reviewed-by: Uri Simchoni (cherry picked from commit fa0015d9adbd3c98957dc61d04b7ffcaa6703e0f) --- ctdb/server/eventscript.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/ctdb/server/eventscript.c b/ctdb/server/eventscript.c index 17e4f35..bd5bc0d 100644 --- a/ctdb/server/eventscript.c +++ b/ctdb/server/eventscript.c @@ -709,6 +709,14 @@ static int ctdb_event_script_callback_v(struct ctdb_context *ctdb, void *private_data, enum ctdb_event call, const char *fmt, va_list ap) + PRINTF_ATTRIBUTE(6,0); + +static int ctdb_event_script_callback_v(struct ctdb_context *ctdb, + const void *mem_ctx, + void (*callback)(struct ctdb_context *, int, void *), + void *private_data, + enum ctdb_event call, + const char *fmt, va_list ap) { struct ctdb_event_script_state *state; -- 2.7.4 From 02bc562dc683101de8a8e558d62a25cff367582a Mon Sep 17 00:00:00 2001 From: Amitay Isaacs Date: Tue, 2 Aug 2016 19:00:54 +1000 Subject: [PATCH 4/6] ctdb-daemon: Fix format-nonliteral warning BUG: https://bugzilla.samba.org/show_bug.cgi?id=12137 Signed-off-by: Amitay Isaacs Reviewed-by: Uri Simchoni (cherry picked from commit 5176354d1279f0e3c216c58ea8637579d9a6a389) --- ctdb/include/ctdb_private.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ctdb/include/ctdb_private.h b/ctdb/include/ctdb_private.h index 59af296..532ae0a 100644 --- a/ctdb/include/ctdb_private.h +++ b/ctdb/include/ctdb_private.h @@ -605,7 +605,8 @@ int switch_from_server_to_client(struct ctdb_context *ctdb, /* From server/ctdb_fork.c */ -void ctdb_set_child_info(TALLOC_CTX *mem_ctx, const char *child_name_fmt, ...); +void ctdb_set_child_info(TALLOC_CTX *mem_ctx, const char *child_name_fmt, + ...) PRINTF_ATTRIBUTE(2,3); void ctdb_track_child(struct ctdb_context *ctdb, pid_t pid); -- 2.7.4 From 575cd33aced2bcab56e4f7727e0cf4de6aa76f96 Mon Sep 17 00:00:00 2001 From: Amitay Isaacs Date: Tue, 2 Aug 2016 19:04:17 +1000 Subject: [PATCH 5/6] ctdb-recovery-helper: Fix format-nonliteral warning ... and printf format errors. BUG: https://bugzilla.samba.org/show_bug.cgi?id=12137 Signed-off-by: Amitay Isaacs Reviewed-by: Uri Simchoni (cherry picked from commit f1a8fb11dda578f194063cdcf2c5dca7000b272b) --- ctdb/server/ctdb_recovery_helper.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/ctdb/server/ctdb_recovery_helper.c b/ctdb/server/ctdb_recovery_helper.c index 6b487b9..9e142cd 100644 --- a/ctdb/server/ctdb_recovery_helper.c +++ b/ctdb/server/ctdb_recovery_helper.c @@ -40,6 +40,8 @@ static int recover_timeout = 30; #define TIMEOUT() timeval_current_ofs(recover_timeout, 0) +static void LOG(const char *fmt, ...) PRINTF_ATTRIBUTE(1,2); + static void LOG(const char *fmt, ...) { va_list ap; @@ -1683,7 +1685,7 @@ static void recover_db_transaction_started(struct tevent_req *subreq) state->count, err_list, &pnn); if (ret2 != 0) { - LOG("control TRANSACTION_DB failed for db=%s," + LOG("control TRANSACTION_DB failed for db=%s on node %u," " ret=%d\n", state->db_name, pnn, ret2); } else { LOG("control TRANSACTION_DB failed for db=%s," @@ -1777,7 +1779,7 @@ static void recover_db_wipedb_done(struct tevent_req *subreq) " ret=%d\n", state->db_name, pnn, ret2); } else { LOG("control WIPEDB failed for db %s, ret=%d\n", - state->db_name, pnn, ret); + state->db_name, ret); } tevent_req_error(req, ret); return; -- 2.7.4 From 5dcadf4156434f1755887019d687802b75c40df2 Mon Sep 17 00:00:00 2001 From: Amitay Isaacs Date: Tue, 2 Aug 2016 18:22:13 +1000 Subject: [PATCH 6/6] ctdb-ib: Fix DEBUG log messages https://bugzilla.samba.org/show_bug.cgi?id=12137 Signed-off-by: Amitay Isaacs Reviewed-by: Uri Simchoni (cherry picked from commit c0246b4cc2c351dced44d28021ee4139bdf7b288) --- ctdb/ib/ibwrapper.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/ctdb/ib/ibwrapper.c b/ctdb/ib/ibwrapper.c index b10aaf5..f7334b5 100644 --- a/ctdb/ib/ibwrapper.c +++ b/ctdb/ib/ibwrapper.c @@ -340,7 +340,7 @@ static int ibw_refill_cq_recv(struct ibw_conn *conn) rc = ibv_post_recv(pconn->cm_id->qp, &wr, &bad_wr); if (rc) { sprintf(ibw_lasterr, "refill/ibv_post_recv failed with %d\n", rc); - DEBUG(DEBUG_ERR, (ibw_lasterr)); + DEBUG(DEBUG_ERR, ("%s", ibw_lasterr)); return -2; } @@ -374,7 +374,7 @@ static int ibw_fill_cq(struct ibw_conn *conn) rc = ibv_post_recv(pconn->cm_id->qp, &wr, &bad_wr); if (rc) { sprintf(ibw_lasterr, "fill/ibv_post_recv failed with %d\n", rc); - DEBUG(DEBUG_ERR, (ibw_lasterr)); + DEBUG(DEBUG_ERR, ("%s", ibw_lasterr)); return -2; } } @@ -651,7 +651,7 @@ static void ibw_event_handler_verbs(struct tevent_context *ev, error: ibv_ack_cq_events(pconn->cq, 1); - DEBUG(DEBUG_ERR, (ibw_lasterr)); + DEBUG(DEBUG_ERR, ("%s", ibw_lasterr)); if (conn->state!=IBWC_ERROR) { conn->state = IBWC_ERROR; @@ -991,7 +991,7 @@ struct ibw_ctx *ibw_init(struct ibw_initattr *attr, int nattr, return ctx; /* don't put code here */ cleanup: - DEBUG(DEBUG_ERR, (ibw_lasterr)); + DEBUG(DEBUG_ERR, ("%s", ibw_lasterr)); if (ctx) talloc_free(ctx); @@ -1029,7 +1029,7 @@ int ibw_bind(struct ibw_ctx *ctx, struct sockaddr_in *my_addr) rc = rdma_bind_addr(pctx->cm_id, (struct sockaddr *) my_addr); if (rc) { sprintf(ibw_lasterr, "rdma_bind_addr error %d\n", rc); - DEBUG(DEBUG_ERR, (ibw_lasterr)); + DEBUG(DEBUG_ERR, ("%s", ibw_lasterr)); return rc; } DEBUG(DEBUG_DEBUG, ("rdma_bind_addr successful\n")); @@ -1046,7 +1046,7 @@ int ibw_listen(struct ibw_ctx *ctx, int backlog) rc = rdma_listen(pctx->cm_id, backlog); if (rc) { sprintf(ibw_lasterr, "rdma_listen failed: %d\n", rc); - DEBUG(DEBUG_ERR, (ibw_lasterr)); + DEBUG(DEBUG_ERR, ("%s", ibw_lasterr)); return rc; } @@ -1068,7 +1068,7 @@ int ibw_accept(struct ibw_ctx *ctx, struct ibw_conn *conn, void *conn_userdata) rc = rdma_accept(pconn->cm_id, &conn_param); if (rc) { sprintf(ibw_lasterr, "rdma_accept failed %d\n", rc); - DEBUG(DEBUG_ERR, (ibw_lasterr)); + DEBUG(DEBUG_ERR, ("%s", ibw_lasterr)); return -1;; } @@ -1115,7 +1115,7 @@ int ibw_connect(struct ibw_conn *conn, struct sockaddr_in *serv_addr, void *conn rc = rdma_resolve_addr(pconn->cm_id, NULL, (struct sockaddr *) serv_addr, 2000); if (rc) { sprintf(ibw_lasterr, "rdma_resolve_addr error %d\n", rc); - DEBUG(DEBUG_ERR, (ibw_lasterr)); + DEBUG(DEBUG_ERR, ("%s", ibw_lasterr)); talloc_free(conn); return -1; } @@ -1142,7 +1142,7 @@ int ibw_disconnect(struct ibw_conn *conn) rc = rdma_disconnect(pconn->cm_id); if (rc) { sprintf(ibw_lasterr, "ibw_disconnect failed with %d\n", rc); - DEBUG(DEBUG_ERR, (ibw_lasterr)); + DEBUG(DEBUG_ERR, ("%s", ibw_lasterr)); return rc; } break; @@ -1280,7 +1280,7 @@ static int ibw_send_packet(struct ibw_conn *conn, void *buf, struct ibw_wr *p, u return 0; error: - DEBUG(DEBUG_ERR, (ibw_lasterr)); + DEBUG(DEBUG_ERR, ("%s", ibw_lasterr)); return -1; } -- 2.7.4