When opening an output file, use "file_snaplen" as the snapshot length,

rather than "pcap_snapshot(ld.pch)" - we've set "file_snaplen" to
"pcap_snapshot(ld.pch)" if we're capturing from a device, but if we're
reading from a pipe, "ld.pch" is null (so we'll crash if we use it), and
we've set "file_snaplen" from the header we've read from a pipe.

svn path=/trunk/; revision=11734
This commit is contained in:
Guy Harris 2004-08-13 08:27:58 +00:00
parent 2875ddd269
commit 10d4e3873a
1 changed files with 2 additions and 2 deletions

View File

@ -1892,14 +1892,14 @@ capture(int out_file_type)
capture_opts.ringbuffer_num_files);
if (cfile.save_file_fd != -1) {
ld.pdh = ringbuf_init_wtap_dump_fdopen(out_file_type, ld.linktype,
pcap_snapshot(ld.pch), &err);
file_snaplen, &err);
} else {
err = errno; /* "ringbuf_init()" failed */
ld.pdh = NULL;
}
} else {
ld.pdh = wtap_dump_open(cfile.save_file, out_file_type,
ld.linktype, pcap_snapshot(ld.pch), &err);
ld.linktype, file_snaplen, &err);
}
if (ld.pdh == NULL) {