]> git.droids-corp.org - dpdk.git/blobdiff - lib/librte_latencystats/rte_latencystats.c
examples/l3fwd-power: fix build with gcc 4
[dpdk.git] / lib / librte_latencystats / rte_latencystats.c
index 5715549e46ee90c81e1c2d12852f920c4911a8d4..06c62831b41542edc7f09856a81fa936674283fe 100644 (file)
@@ -7,6 +7,7 @@
 #include <stdbool.h>
 #include <math.h>
 
+#include <rte_string_fns.h>
 #include <rte_mbuf.h>
 #include <rte_log.h>
 #include <rte_cycles.h>
@@ -309,8 +310,8 @@ rte_latencystats_get_names(struct rte_metric_name *names, uint16_t size)
                return NUM_LATENCY_STATS;
 
        for (i = 0; i < NUM_LATENCY_STATS; i++)
-               snprintf(names[i].name, sizeof(names[i].name),
-                               "%s", lat_stats_strings[i].name);
+               strlcpy(names[i].name, lat_stats_strings[i].name,
+                       sizeof(names[i].name));
 
        return NUM_LATENCY_STATS;
 }