interface: use the correct condition for checking if the pcap fd is open
[vpp.git] / src / vlib / main.c
index 2df935a..f49790d 100644 (file)
@@ -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)