aboutgitcodebugslistschat
path: root/pcap.c
diff options
context:
space:
mode:
authorStefano Brivio <sbrivio@redhat.com>2021-10-21 09:41:13 +0200
committerStefano Brivio <sbrivio@redhat.com>2021-10-21 09:41:13 +0200
commit627e18fa8ad000ed92405cff3a88c36fd5f3027e (patch)
tree5caf72002139dd6bc80cd424de1730f8602cbb9d /pcap.c
parentc3f8e4d2cd55e57419478ff849265d1e342e7990 (diff)
downloadpasst-627e18fa8ad000ed92405cff3a88c36fd5f3027e.tar
passt-627e18fa8ad000ed92405cff3a88c36fd5f3027e.tar.gz
passt-627e18fa8ad000ed92405cff3a88c36fd5f3027e.tar.bz2
passt-627e18fa8ad000ed92405cff3a88c36fd5f3027e.tar.lz
passt-627e18fa8ad000ed92405cff3a88c36fd5f3027e.tar.xz
passt-627e18fa8ad000ed92405cff3a88c36fd5f3027e.tar.zst
passt-627e18fa8ad000ed92405cff3a88c36fd5f3027e.zip
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 <sbrivio@redhat.com>
Diffstat (limited to 'pcap.c')
-rw-r--r--pcap.c6
1 files changed, 4 insertions, 2 deletions
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));