app/flow-perf: support meter action
[dpdk.git] / examples / vm_power_manager / channel_manager.c
index 4ac21f0..a263150 100644 (file)
@@ -4,7 +4,6 @@
 
 #include <stdio.h>
 #include <stdlib.h>
-#include <sys/un.h>
 #include <fcntl.h>
 #include <unistd.h>
 #include <inttypes.h>
@@ -35,6 +34,8 @@
 
 #define RTE_LOGTYPE_CHANNEL_MANAGER RTE_LOGTYPE_USER1
 
+struct libvirt_vm_info lvm_info[MAX_CLIENTS];
+
 /* Global pointer to libvirt connection */
 static virConnectPtr global_vir_conn_ptr;
 
@@ -466,9 +467,15 @@ add_all_channels(const char *vm_name)
                        continue;
                }
 
-               snprintf(chan_info->channel_path,
+               if ((size_t)snprintf(chan_info->channel_path,
                                sizeof(chan_info->channel_path), "%s%s",
-                               CHANNEL_MGR_SOCKET_PATH, dir->d_name);
+                               CHANNEL_MGR_SOCKET_PATH, dir->d_name)
+                                       >= sizeof(chan_info->channel_path)) {
+                       RTE_LOG(ERR, CHANNEL_MANAGER, "Pathname too long for channel '%s%s'\n",
+                                       CHANNEL_MGR_SOCKET_PATH, dir->d_name);
+                       rte_free(chan_info);
+                       continue;
+               }
 
                if (setup_channel_info(&vm_info, &chan_info, channel_num) < 0) {
                        rte_free(chan_info);