aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/dpdk/device/init.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/dpdk/device/init.c')
-rw-r--r--src/plugins/dpdk/device/init.c22
1 files changed, 15 insertions, 7 deletions
diff --git a/src/plugins/dpdk/device/init.c b/src/plugins/dpdk/device/init.c
index ebb43d1a86f..a08ed6d908f 100644
--- a/src/plugins/dpdk/device/init.c
+++ b/src/plugins/dpdk/device/init.c
@@ -1356,14 +1356,22 @@ dpdk_config (vlib_main_t * vm, unformat_input_t * input)
int log_fds[2] = { 0 };
if (pipe (log_fds) == 0)
{
- FILE *f = fdopen (log_fds[1], "a");
- if (f && rte_openlog_stream (f) == 0)
+ if (fcntl (log_fds[1], F_SETFL, O_NONBLOCK) == 0)
{
- clib_file_t t = { 0 };
- t.read_function = dpdk_log_read_ready;
- t.file_descriptor = log_fds[0];
- t.description = format (0, "DPDK logging pipe");
- clib_file_add (&file_main, &t);
+ FILE *f = fdopen (log_fds[1], "a");
+ if (f && rte_openlog_stream (f) == 0)
+ {
+ clib_file_t t = { 0 };
+ t.read_function = dpdk_log_read_ready;
+ t.file_descriptor = log_fds[0];
+ t.description = format (0, "DPDK logging pipe");
+ clib_file_add (&file_main, &t);
+ }
+ }
+ else
+ {
+ close (log_fds[0]);
+ close (log_fds[1]);
}
}