From: Guy Lewin Date: Sat, 7 Apr 2018 22:04:58 +0000 (+0300) Subject: When SIGINFO (or SIGUSR1) signal sent, also flush the buffer. Useful when you want... X-Git-Tag: tcpdump-4.99-bp~1213^2~1 X-Git-Url: https://git.tcpdump.org/tcpdump/commitdiff_plain/ff30ebc5428e7f51c8970cba84f5c7e292c0ae42 When SIGINFO (or SIGUSR1) signal sent, also flush the buffer. Useful when you want to download the dump file and want to have all of the packets. --- diff --git a/tcpdump.c b/tcpdump.c index 7d6d5099..dbec2f88 100644 --- a/tcpdump.c +++ b/tcpdump.c @@ -255,6 +255,7 @@ static const struct tok status_flags[] = { }; #endif +static pcap_dumper_t *p = NULL; static pcap_t *pd; static int supports_monitor_mode; @@ -2178,7 +2179,6 @@ DIAG_ON_CLANG(assign-enum) } #endif if (WFileName) { - pcap_dumper_t *p; /* Do not exceed the default PATH_MAX for files. */ dumpinfo.CurrentFileName = (char *)malloc(PATH_MAX + 1); @@ -2905,6 +2905,11 @@ void requestinfo(int signo _U_) ++infoprint; else info(0); + +#ifdef HAVE_PCAP_DUMP_FLUSH + if (p != NULL) + pcap_dump_flush(p); +#endif } #endif