]> The Tcpdump Group git mirrors - tcpdump/commitdiff
If -U is specified, flush the file after creating it, so it's not zero-length.
authorRomain Francoise <[email protected]>
Sat, 5 Jun 2010 07:37:27 +0000 (00:37 -0700)
committerGuy Harris <[email protected]>
Sat, 5 Jun 2010 07:37:27 +0000 (00:37 -0700)
Reading from a capture file that has not yet received any packets fails
with "truncated dump file"; to avoid this, flush the file (forcing the
pcap header out) immediately after opening it.

(Added Romain to the credits.)

Reviewed-By: Guy Harris <[email protected]>
CREDITS
tcpdump.c

diff --git a/CREDITS b/CREDITS
index a89a2f1d1c053a03eb91295e212c174ff71394f1..e75b65f249809fb03e5a5515c97498a12ed01546 100644 (file)
--- a/CREDITS
+++ b/CREDITS
@@ -155,6 +155,7 @@ Additional people who have contributed patches:
        Rob Braun                       <bbraun at synack dot net>
        Robert Edmonds                  <stu-42 at sourceforge dot net>
        Roderick Schertler              <roderick at argon dot org>
+       Romain Francoise                <rfrancoise at debian dot org>
        Sagun Shakya                    <sagun dot shakya at sun dot com>
        Sami Farin                      <safari at iki dot fi>
        Scott Rose                      <syberpunk at users dot sourceforge dot net>
index b26188f56399af252407977b7c989708c5bd89c2..2f1203962071badec941cf6888539e3b4d5ef375 100644 (file)
--- a/tcpdump.c
+++ b/tcpdump.c
@@ -1212,6 +1212,10 @@ main(int argc, char **argv)
                        callback = dump_packet;
                        pcap_userdata = (u_char *)p;
                }
+#ifdef HAVE_PCAP_DUMP_FLUSH
+               if (Uflag)
+                       pcap_dump_flush(p);
+#endif
        } else {
                type = pcap_datalink(pd);
                 printinfo.ndo_type = 1;