From e4b94da0af90e7ab707fd32d9e09e7bd767996df Mon Sep 17 00:00:00 2001 From: Stefano Brivio Date: Mon, 27 Sep 2021 00:18:00 +0200 Subject: pcap: Don't reinitialise packet capture if we already have one If the guest disconnects, and a given name (without timestamp) for the pcap file is passed, we would otherwise lose the packets captured until that point. Signed-off-by: Stefano Brivio --- pcap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pcap.c b/pcap.c index 43474da..1d7dd49 100644 --- a/pcap.c +++ b/pcap.c @@ -162,7 +162,7 @@ void pcap_init(struct ctx *c, int index) struct tm *tm; if (pcap_fd != -1) - close(pcap_fd); + return; if (!*c->pcap) return; -- cgit v1.2.3