Dumpcap: Update our pipe closed logic.

Check for pipe status only when we no longer have packets. This keeps us
from flushing packets that we should have written.

Change-Id: I714f52597da792a0b228b5e1a1dd3a993dc93681
Reviewed-on: https://code.wireshark.org/review/30651
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Gerald Combs <gerald@wireshark.org>
This commit is contained in:
Gerald Combs 2018-11-15 08:05:17 -08:00
parent e6c6f99e87
commit 6c66a639d0
1 changed files with 12 additions and 10 deletions

View File

@ -3817,17 +3817,19 @@ capture_loop_start(capture_options *capture_opts, gboolean *stats_known, struct
inpkts = capture_loop_dispatch(&global_ld, errmsg,
sizeof(errmsg), pcap_src);
}
/* Stop capturing if all of our sources are pipes and none of them are open. */
gboolean open_interfaces = FALSE;
for (i = 0; i < global_ld.pcaps->len; i++) {
pcap_src = g_array_index(global_ld.pcaps, capture_src *, i);
if (pcap_src->cap_pipe_err == PIPOK) {
/* True for both non-pipes and open pipes. */
open_interfaces = TRUE;
if (inpkts == 0) {
/* Stop capturing if all of our sources are pipes and none of them are open. */
gboolean open_interfaces = FALSE;
for (i = 0; i < global_ld.pcaps->len; i++) {
pcap_src = g_array_index(global_ld.pcaps, capture_src *, i);
if (pcap_src->cap_pipe_err == PIPOK) {
/* True for both non-pipes and open pipes. */
open_interfaces = TRUE;
}
}
if (!open_interfaces) {
global_ld.go = FALSE;
}
}
if (!open_interfaces) {
global_ld.go = FALSE;
}
#ifdef SIGINFO
/* Were we asked to print packet counts by the SIGINFO handler? */