diff options
author | Romain Francoise <rfrancoise@debian.org> | 2010-06-05 00:37:27 -0700 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2010-06-05 00:37:27 -0700 |
commit | 768c379e643e28184fe267700859a698cc90faf8 (patch) | |
tree | 13f971ef3774c543a3f4a35bfb1f2c3ececfab87 | |
parent | 156d01c798cfba1e53d385c844d60bcb01240a4e (diff) | |
download | tcpdump-768c379e643e28184fe267700859a698cc90faf8.tar.gz |
If -U is specified, flush the file after creating it, so it's not zero-length.
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 <guy@alum.mit.edu>
-rw-r--r-- | CREDITS | 1 | ||||
-rw-r--r-- | tcpdump.c | 4 |
2 files changed, 5 insertions, 0 deletions
@@ -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> @@ -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; |