diff --git a/libxcm/core/log.h b/libxcm/core/log.h index b21eb57fe..8e918f970 100644 --- a/libxcm/core/log.h +++ b/libxcm/core/log.h @@ -40,5 +40,7 @@ bool log_is_enabled(enum log_type type); void __log_event(enum log_type type, const char *file, int line, const char *function, struct xcm_socket *s, - const char *format, ...); + const char *format, ...) + __attribute__((format (printf, 6, 7))); + #endif diff --git a/libxcm/core/log_attr_tree.h b/libxcm/core/log_attr_tree.h index b6d184c59..8b6198ec5 100644 --- a/libxcm/core/log_attr_tree.h +++ b/libxcm/core/log_attr_tree.h @@ -32,7 +32,7 @@ log_attr_type_name(actual_type)) #define LOG_ATTR_TREE_NODE_IS_NOT_VALUE(s, path_str) \ - log_debug_sock(s, "Attribute at \"%s\" is a dictionary or list.") + log_debug_sock(s, "Attribute at \"%s\" is a dictionary or list.", path_str) #define LOG_ATTR_TREE_NON_EXISTENT(s, name) \ log_debug_sock(s, "Attribute \"%s\" does not exist.", name) @@ -66,7 +66,7 @@ } while (0) #define LOG_ATTR_TREE_NODE_IS_NOT_LIST(s, path_str) \ - log_debug_sock(s, "Attribute at \"%s\" is not a list.") + log_debug_sock(s, "Attribute at \"%s\" is not a list.", path_str) #define LOG_ATTR_TREE_LIST_LEN_RESULT(s, attr_name, len) \ log_debug_sock(s, "Length of \"%s\" is %d.", attr_name, len) diff --git a/libxcm/tp/common/log_tp.h b/libxcm/tp/common/log_tp.h index 030bdd0e1..693d29531 100644 --- a/libxcm/tp/common/log_tp.h +++ b/libxcm/tp/common/log_tp.h @@ -196,7 +196,7 @@ "layer.") #define LOG_SEND_BUF_LINGER(conn_sock, left) \ - log_debug_sock(conn_sock, "%zd bytes not yet delivered to lower " \ + log_debug_sock(conn_sock, "%d bytes not yet delivered to lower " \ "layer.", left) #define LOG_FILL_BUFFER_ATTEMPT(conn_sock, len) \ @@ -226,7 +226,7 @@ len) #define LOG_RCV_MSG(conn_sock, len) \ - log_debug_sock(conn_sock, "Received a complete %d byte message from " \ + log_debug_sock(conn_sock, "Received a complete %zd byte message from " \ "lower layer.", len) #define LOG_RCV_MSG_TRUNCATED(conn_sock, capacity, len) \ diff --git a/libxcm/tp/tcp/xcm_tp_btcp.c b/libxcm/tp/tcp/xcm_tp_btcp.c index 65c407829..2a85cef39 100644 --- a/libxcm/tp/tcp/xcm_tp_btcp.c +++ b/libxcm/tp/tcp/xcm_tp_btcp.c @@ -640,7 +640,7 @@ static int btcp_send(struct xcm_socket *__restrict s, int rc = send(bts->fd, buf, len, MSG_NOSIGNAL); if (rc > 0) { - LOG_SEND_ACCEPTED(s, buf, rc); + LOG_SEND_ACCEPTED(s, buf, (size_t)rc); XCM_TP_CNT_BYTES_INC(bts->conn.cnts, from_app, rc); LOG_LOWER_DELIVERED_PART(s, rc); @@ -979,7 +979,7 @@ static int set_dns_algorithm_attr(struct xcm_socket *s, void *context, enum tconnect_algorithm algorithm = tconnect_algorithm_enum(value); if (algorithm == tconnect_algorithm_none) { - LOG_INVALID_DNS_ALGORITHM(s, value); + LOG_INVALID_DNS_ALGORITHM(s, (const char *)value); errno = EINVAL; return -1; } diff --git a/libxcm/tp/tls/log_tls.h b/libxcm/tp/tls/log_tls.h index 5c84234d2..c568db283 100644 --- a/libxcm/tp/tls/log_tls.h +++ b/libxcm/tp/tls/log_tls.h @@ -113,7 +113,7 @@ ut_aprintf(buf, sizeof(buf), "; CRL \"%s\"", \ item_unsensitive_data(crl)); \ ut_aprintf(buf, sizeof(buf), "."); \ - log_debug_sock(s, buf); \ + log_debug_sock(s, "%s", buf); \ } while (0) #define LOG_TLS_CREATING_CTX(s, cert, key, tc, crl) \ @@ -142,7 +142,7 @@ void hash_description(uint8_t *hash, size_t hash_len, char *buf); ut_aprintf(buf, sizeof(buf), "; CRL \"%s\"", \ item_unsensitive_data(crl)); \ ut_aprintf(buf, sizeof(buf), " %s %s.", event, hash_desc); \ - log_debug_sock(s, buf); \ + log_debug_sock(s, "%s", buf); \ } while (0) #define LOG_TLS_CTX_HASH(s, cert, key, tc, crl, hash, hash_size) \ diff --git a/libxcm/tp/tls/xcm_tp_btls.c b/libxcm/tp/tls/xcm_tp_btls.c index 763dc3891..497e2eb94 100644 --- a/libxcm/tp/tls/xcm_tp_btls.c +++ b/libxcm/tp/tls/xcm_tp_btls.c @@ -1034,7 +1034,7 @@ static int btls_send(struct xcm_socket *__restrict s, UT_RESTORE_ERRNO(write_errno); if (rc > 0) { - LOG_SEND_ACCEPTED(s, buf, rc); + LOG_SEND_ACCEPTED(s, buf, (size_t)rc); XCM_TP_CNT_BYTES_INC(bts->conn.cnts, from_app, rc); LOG_LOWER_DELIVERED_PART(s, rc); diff --git a/libxcm/tp/ux/xcm_tp_ux.c b/libxcm/tp/ux/xcm_tp_ux.c index 4fd86b941..0fa60733c 100644 --- a/libxcm/tp/ux/xcm_tp_ux.c +++ b/libxcm/tp/ux/xcm_tp_ux.c @@ -392,7 +392,7 @@ static int ux_receive(struct xcm_socket *__restrict s, int rc = recv(us->fd, buf, capacity, MSG_TRUNC); if (rc > 0) { - LOG_RCV_MSG(s, rc); + LOG_RCV_MSG(s, (size_t)rc); XCM_TP_CNT_MSG_INC(us->cnts, from_lower, rc); LOG_APP_DELIVERED(s, rc); XCM_TP_CNT_MSG_INC(us->cnts, to_app, rc);