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 /tcpdump.c | |
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>
Diffstat (limited to 'tcpdump.c')
-rw-r--r-- | tcpdump.c | 4 |
1 files changed, 4 insertions, 0 deletions
@@ -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; |