File Fix-compile-warnings-with-GCC-7.2.1.patch of Package corosync.22097
//cpg_test_agent: Fix snprintf compiler warnings
---
cts/agents/cpg_test_agent.c | 8 ++++----
exec/coroparse.c | 18 +++---------------
lib/sam.c | 36 ++++++++++++++++++++++++++++--------
tools/corosync-quorumtool.c | 2 +-
4 files changed, 36 insertions(+), 28 deletions(-)
diff --git a/cts/agents/cpg_test_agent.c b/cts/agents/cpg_test_agent.c
index 0837c69c..2224141c 100644
--- a/cts/agents/cpg_test_agent.c
+++ b/cts/agents/cpg_test_agent.c
@@ -211,8 +211,8 @@ static void config_change_callback (
if (record_config_events_g > 0) {
log_pt = malloc (sizeof(log_entry_t));
list_init (&log_pt->list);
- snprintf (log_pt->log, LOG_STR_SIZE, "%s,%u,%u,left",
- groupName->value, left_list[i].nodeid,left_list[i].pid);
+ assert(snprintf (log_pt->log, LOG_STR_SIZE, "%s,%u,%u,left",
+ groupName->value, left_list[i].nodeid,left_list[i].pid) < LOG_STR_SIZE);
list_add_tail(&log_pt->list, &config_chg_log_head);
qb_log (LOG_INFO, "cpg event %s", log_pt->log);
}
@@ -221,8 +221,8 @@ static void config_change_callback (
if (record_config_events_g > 0) {
log_pt = malloc (sizeof(log_entry_t));
list_init (&log_pt->list);
- snprintf (log_pt->log, LOG_STR_SIZE, "%s,%u,%u,join",
- groupName->value, joined_list[i].nodeid,joined_list[i].pid);
+ assert(snprintf (log_pt->log, LOG_STR_SIZE, "%s,%u,%u,join",
+ groupName->value, joined_list[i].nodeid,joined_list[i].pid) < LOG_STR_SIZE);
list_add_tail (&log_pt->list, &config_chg_log_head);
qb_log (LOG_INFO, "cpg event %s", log_pt->log);
}
--
2.13.6