Suppress warning -Wformat-truncation in ACLK (#9547)
* suppress some truncation warning in places we want truncation
Timotej S committed
Jul 16, 2020 at 11:56 UTC
ee1eb0f9c510a9bea853d84e7ff6d9caa4a097b5
2 files changed
+4
-2
aclk/aclk_query.c
+2
-1
@@ -488,7 +488,8 @@ void aclk_query_threads_start(struct aclk_query_threads *query_threads)
488
for (int i = 0; i < query_threads->count; i++) {
489
query_threads->thread_list[i].idx = i; //thread needs to know its index for statistics
490
491
- snprintf(thread_name, TASK_LEN_MAX, "%s_%d", ACLK_THREAD_NAME, i);
491
+ if(unlikely(snprintf(thread_name, TASK_LEN_MAX, "%s_%d", ACLK_THREAD_NAME, i) < 0))
492
+ error("snprintf encoding error");
493
netdata_thread_create(
494
&query_threads->thread_list[i].thread, thread_name, NETDATA_THREAD_OPTION_JOINABLE, aclk_query_main_thread,
495
&query_threads->thread_list[i]);
aclk/aclk_stats.c
+2
-1
@@ -167,7 +167,8 @@ static void aclk_stats_query_threads(uint32_t *queries_per_thread)
167
"netdata", "stats", 200007, localhost->rrd_update_every, RRDSET_TYPE_STACKED);
168
169
for (int i = 0; i < query_thread_count; i++) {
170
- snprintf(dim_name, MAX_DIM_NAME, "Query %d", i);
170
+ if (snprintf(dim_name, MAX_DIM_NAME, "Query %d", i) < 0)
171
+ error("snprintf encoding error");
172
aclk_qt_data[i].dim = rrddim_add(st, dim_name, NULL, 1, localhost->rrd_update_every, RRD_ALGORITHM_ABSOLUTE);
173
}
174
} else