summaryrefslogtreecommitdiff
path: root/tcpdump.c
diff options
context:
space:
mode:
authorRomain Francoise <rfrancoise@debian.org>2010-06-05 00:37:27 -0700
committerGuy Harris <guy@alum.mit.edu>2010-06-05 00:37:27 -0700
commit768c379e643e28184fe267700859a698cc90faf8 (patch)
tree13f971ef3774c543a3f4a35bfb1f2c3ececfab87 /tcpdump.c
parent156d01c798cfba1e53d385c844d60bcb01240a4e (diff)
downloadtcpdump-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.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/tcpdump.c b/tcpdump.c
index b26188f5..2f120396 100644
--- 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;