diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/vlib/main.c | 2 | ||||
-rw-r--r-- | src/vnet/interface_cli.c | 2 | ||||
-rw-r--r-- | src/vnet/interface_output.c | 2 | ||||
-rw-r--r-- | src/vnet/pg/output.c | 2 |
4 files changed, 4 insertions, 4 deletions
diff --git a/src/vlib/main.c b/src/vlib/main.c index 2df935a5e17..f49790d28b5 100644 --- a/src/vlib/main.c +++ b/src/vlib/main.c @@ -2254,7 +2254,7 @@ vlib_pcap_dispatch_trace_configure (vlib_pcap_dispatch_trace_args_t * a) vlib_cli_output (vm, "Write %d packets to %s, and stop capture...", pm->n_packets_captured, pm->file_name); error = pcap_write (pm); - if (pm->file_descriptor >= 0) + if (pm->flags & PCAP_MAIN_INIT_DONE) pcap_close (pm); /* Report I/O errors... */ if (error) diff --git a/src/vnet/interface_cli.c b/src/vnet/interface_cli.c index a635879932c..08d9628730c 100644 --- a/src/vnet/interface_cli.c +++ b/src/vnet/interface_cli.c @@ -1766,7 +1766,7 @@ vnet_pcap_dispatch_trace_configure (vnet_pcap_dispatch_trace_args_t * a) vlib_cli_output (vm, "Write %d packets to %s, and stop capture...", pm->n_packets_captured, pm->file_name); error = pcap_write (pm); - if (pm->file_descriptor >= 0) + if (pm->flags & PCAP_MAIN_INIT_DONE) pcap_close (pm); /* Report I/O errors... */ if (error) diff --git a/src/vnet/interface_output.c b/src/vnet/interface_output.c index 9702a9e31ee..bf21587ae4d 100644 --- a/src/vnet/interface_output.c +++ b/src/vnet/interface_output.c @@ -1441,7 +1441,7 @@ pcap_drop_trace_command_fn (vlib_main_t * vm, im->pcap_main.n_packets_to_capture = im->pcap_main.n_packets_captured; error = pcap_write (&im->pcap_main); - if (im->pcap_main.file_descriptor >= 0) + if (im->pcap_main.flags & PCAP_MAIN_INIT_DONE) pcap_close (&im->pcap_main); if (error) clib_error_report (error); diff --git a/src/vnet/pg/output.c b/src/vnet/pg/output.c index b5ee157b4c6..d8059fab186 100644 --- a/src/vnet/pg/output.c +++ b/src/vnet/pg/output.c @@ -79,7 +79,7 @@ pg_output (vlib_main_t * vm, vlib_node_runtime_t * node, vlib_frame_t * frame) } if (pif->pcap_file_name != 0) pcap_write (&pif->pcap_main); - if (pif->pcap_main.file_descriptor >= 0 + if ((pif->pcap_main.flags & PCAP_MAIN_INIT_DONE) && pif->pcap_main.n_packets_captured >= pif->pcap_main.n_packets_to_capture) pcap_close (&pif->pcap_main); |