Merge pull request #2742 from elfiesmelfie/ipmi_bugfix_sensor_option
[collectd.git] / src / utils_dpdk.c
index 2f37818..fbdcaf8 100644 (file)
@@ -45,7 +45,9 @@
 
 #define DPDK_DEFAULT_RTE_CONFIG "/var/run/.rte_config"
 #define DPDK_EAL_ARGC 10
-// Complete trace should fit into 1024 chars
+// Complete trace should fit into 1024 chars. Trace contain some headers
+// and text together with traced data from pipe. This is the reason why
+// we need to limit DPDK_MAX_BUFFER_SIZE value.
 #define DPDK_MAX_BUFFER_SIZE 896
 #define DPDK_CDM_DEFAULT_TIMEOUT 10000
 
@@ -731,8 +733,8 @@ static void dpdk_helper_check_pipe(dpdk_helper_ctx_t *phc) {
     DEBUG("%s:dpdk_helper_check_pipe: read nbytes=%d", phc->shm_name, nbytes);
     if (nbytes <= 0)
       break;
-    buf[nbytes] = '\n';
-    sstrncpy(out, buf, (nbytes + 1));
+    buf[nbytes] = '\0';
+    sstrncpy(out, buf, sizeof(out));
     DEBUG("%s: helper process:\n%s", phc->shm_name, out);
   }
 }