diff --git a/epan/follow.c b/epan/follow.c index 5e819e4cd4..55f5be3c9e 100644 --- a/epan/follow.c +++ b/epan/follow.c @@ -51,7 +51,8 @@ typedef struct _tcp_frag { FILE* data_out_file = NULL; -gboolean incomplete_tcp_stream = FALSE; +gboolean empty_tcp_stream; +gboolean incomplete_tcp_stream; static guint8 ip_address[2][MAX_IPADDR_LEN]; static guint tcp_port[2]; @@ -304,9 +305,12 @@ check_fragments( int index, tcp_stream_chunk *sc ) { /* this should always be called before we start to reassemble a stream */ void -reset_tcp_reassembly() { +reset_tcp_reassembly(void) +{ tcp_frag *current, *next; int i; + + empty_tcp_stream = TRUE; incomplete_tcp_stream = FALSE; for( i=0; i<2; i++ ) { seq[i] = 0; @@ -332,4 +336,5 @@ write_packet_data( int index, tcp_stream_chunk *sc, const char *data ) DISSECTOR_ASSERT(1 * sizeof(tcp_stream_chunk) == fwrite( sc, 1, sizeof(tcp_stream_chunk), data_out_file )); DISSECTOR_ASSERT(1 * sc->dlen == fwrite( data, 1, sc->dlen, data_out_file )); bytes_written[index] += sc->dlen; + empty_tcp_stream = FALSE; } diff --git a/epan/follow.h b/epan/follow.h index 9d92624db8..86edbd3aca 100644 --- a/epan/follow.h +++ b/epan/follow.h @@ -32,6 +32,7 @@ #define MAX_IPADDR_LEN 16 /* With MSVC and a libwireshark.dll, we need a special declaration. */ +WS_VAR_IMPORT gboolean empty_tcp_stream; WS_VAR_IMPORT gboolean incomplete_tcp_stream; typedef struct _tcp_stream_chunk { diff --git a/gtk/follow_dlg.c b/gtk/follow_dlg.c index 59e012caae..f8952f0d1d 100644 --- a/gtk/follow_dlg.c +++ b/gtk/follow_dlg.c @@ -256,7 +256,6 @@ follow_stream_cb(GtkWidget * w, gpointer data _U_) "!(%s)", follow_filter); } - gtk_entry_set_text(GTK_ENTRY(filter_te), follow_filter); /* Run the display filter so it goes in effect - even if it's the @@ -266,6 +265,16 @@ follow_stream_cb(GtkWidget * w, gpointer data _U_) /* Free the filter string, as we're done with it. */ g_free(follow_filter); + /* Check whether we got any data written to the file. */ + if (empty_tcp_stream) { + simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, + "The packets in the capture file for that stream have no data."); + eth_close(tmp_fd); + unlink(follow_info->data_out_filename); + g_free(follow_info); + return; + } + /* Go back to the top of the file and read the first tcp_stream_chunk * to ensure that the IP addresses and port numbers in the drop-down * list are tied to the correct lines displayed by follow_read_stream()