From 627e18fa8ad000ed92405cff3a88c36fd5f3027e Mon Sep 17 00:00:00 2001 From: Stefano Brivio Date: Thu, 21 Oct 2021 09:41:13 +0200 Subject: passt: Add cppcheck target, test, and address resulting warnings ...mostly false positives, but a number of very relevant ones too, in tcp_get_sndbuf(), tcp_conn_from_tap(), and siphash PREAMBLE(). Signed-off-by: Stefano Brivio --- pcap.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'pcap.c') diff --git a/pcap.c b/pcap.c index 2c390f2..7b5a1af 100644 --- a/pcap.c +++ b/pcap.c @@ -172,9 +172,7 @@ fail: */ void pcap_init(struct ctx *c, int index) { - char name[] = PCAP_PREFIX PCAP_ISO8601_STR STR(UINT_MAX) ".pcap"; struct timeval tv; - struct tm *tm; if (pcap_fd != -1) return; @@ -183,6 +181,10 @@ void pcap_init(struct ctx *c, int index) return; if (*c->pcap == 1) { + char name[] = PCAP_PREFIX PCAP_ISO8601_STR STR(UINT_MAX) + ".pcap"; + struct tm *tm; + if (c->mode == MODE_PASTA) memcpy(name, PCAP_PREFIX_PASTA, sizeof(PCAP_PREFIX_PASTA)); -- cgit v1.2.3