]> The Tcpdump Group git mirrors - tcpdump/commitdiff
When SIGINFO (or SIGUSR1) signal sent, also flush the buffer. Useful when you want...
authorGuy Lewin <[email protected]>
Sat, 7 Apr 2018 22:04:58 +0000 (01:04 +0300)
committerGuy Lewin <[email protected]>
Sat, 7 Apr 2018 22:04:58 +0000 (01:04 +0300)
tcpdump.c

index 7d6d509913fd3f27086856c708d79a992e97739d..dbec2f8899b99253c63321834efc00cd898c667e 100644 (file)
--- 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