Check for "wtap_seek_read()" failing.

svn path=/trunk/; revision=8364
This commit is contained in:
Guy Harris 2003-09-03 23:32:40 +00:00
parent 4a4d2dcf7e
commit d7c622e309
4 changed files with 41 additions and 15 deletions

View File

@ -1,6 +1,6 @@
/* main.c
*
* $Id: main.c,v 1.308 2003/09/03 10:49:03 sahlberg Exp $
* $Id: main.c,v 1.309 2003/09/03 23:32:40 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@ -470,9 +470,12 @@ get_text_from_packet_list(gpointer data)
int err;
if (fdata != NULL) {
/* XXX - do something with "err" */
wtap_seek_read(cfile.wth, fdata->file_off, &cfile.pseudo_header,
cfile.pd, fdata->cap_len, &err);
if (!wtap_seek_read(cfile.wth, fdata->file_off, &cfile.pseudo_header,
cfile.pd, fdata->cap_len, &err)) {
simple_dialog(ESD_TYPE_CRIT, NULL,
file_read_error_message(err), cfile.filename);
return NULL;
}
edt = epan_dissect_new(FALSE, FALSE);
epan_dissect_run(edt, &cfile.pseudo_header, cfile.pd, fdata,

View File

@ -1,7 +1,7 @@
/*
* tap_rtp.c
*
* $Id: tap_rtp.c,v 1.13 2003/05/28 01:09:57 gerald Exp $
* $Id: tap_rtp.c,v 1.14 2003/09/03 23:32:40 guy Exp $
*
* RTP analysing addition for ethereal
*
@ -1239,7 +1239,11 @@ static void rtp_analyse_cb(GtkWidget *w _U_, gpointer data _U_)
/* XXX instead of looking for RTP protocol like this, we could do the process_node() staff */
/* dissect the current frame */
wtap_seek_read(cf->wth, fdata->file_off, &cf->pseudo_header, cf->pd, fdata->cap_len, &err);
if (!wtap_seek_read(cf->wth, fdata->file_off, &cf->pseudo_header, cf->pd, fdata->cap_len, &err)) {
simple_dialog(ESD_TYPE_CRIT, NULL,
file_read_error_message(err), cf->filename);
return;
}
edt = epan_dissect_new(TRUE, FALSE);
epan_dissect_prime_dfilter(edt, sfcode);
epan_dissect_run(edt, &cf->pseudo_header, cf->pd, fdata, &cf->cinfo);

View File

@ -3,7 +3,7 @@
* By Pavel Mores <pvl@uh.cz>
* Win32 port: rwh@unifiedtech.com
*
* $Id: tcp_graph.c,v 1.33 2003/08/18 18:41:25 guy Exp $
* $Id: tcp_graph.c,v 1.34 2003/09/03 23:32:40 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@ -1791,8 +1791,13 @@ static void graph_segment_list_get (struct graph *g)
for (ptr=cfile.plist; ptr; ptr=ptr->next) {
/* XXX - do something with "err" */
wtap_seek_read (cfile.wth, ptr->file_off, &pseudo_header,
pd, ptr->cap_len, &err);
if (!wtap_seek_read (cfile.wth, ptr->file_off, &pseudo_header,
pd, ptr->cap_len, &err)) {
simple_dialog(ESD_TYPE_CRIT, NULL,
file_read_error_message(err),
cfile.filename);
break;
}
if (!segment)
segment = (struct segment * )malloc (sizeof (struct segment));
if (!segment)

View File

@ -1,7 +1,7 @@
/* proto_hier_stats.c
* Routines for calculating statistics based on protocol.
*
* $Id: proto_hier_stats.c,v 1.16 2002/08/28 21:00:41 jmayer Exp $
* $Id: proto_hier_stats.c,v 1.17 2003/09/03 23:32:40 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@ -29,6 +29,7 @@
#include "globals.h"
#include "proto_hier_stats.h"
#include "progress_dlg.h"
#include "simple_dialog.h"
#include <epan/epan_dissect.h>
#include <wtap.h>
@ -120,7 +121,7 @@ process_tree(proto_tree *protocol_tree, ph_stats_t* ps, guint pkt_len)
process_node(ptree_node, ps->stats_tree, ps, pkt_len);
}
static void
static gboolean
process_frame(frame_data *frame, column_info *cinfo, ph_stats_t* ps)
{
epan_dissect_t *edt;
@ -129,9 +130,12 @@ process_frame(frame_data *frame, column_info *cinfo, ph_stats_t* ps)
int err;
/* Load the frame from the capture file */
/* XX - do something with "err" */
wtap_seek_read(cfile.wth, frame->file_off, &phdr,
pd, frame->cap_len, &err);
if (!wtap_seek_read(cfile.wth, frame->file_off, &phdr, pd,
frame->cap_len, &err)) {
simple_dialog(ESD_TYPE_CRIT, NULL,
file_read_error_message(err), cfile.filename);
return FALSE; /* failure */
}
/* Dissect the frame */
edt = epan_dissect_new(TRUE, FALSE);
@ -142,6 +146,8 @@ process_frame(frame_data *frame, column_info *cinfo, ph_stats_t* ps)
/* Free our memory. */
epan_dissect_free(edt);
return TRUE; /* success */
}
@ -221,7 +227,15 @@ ph_stats_new(void)
probably do so for other loops (see "file.c") that
look only at those packets. */
if (frame->flags.passed_dfilter) {
process_frame(frame, &cfile.cinfo, ps);
if (!process_frame(frame, &cfile.cinfo, ps)) {
/*
* Give up, and set "stop_flag" so we
* just abort rather than popping up
* the statistics window.
*/
stop_flag = TRUE;
break;
}
tot_packets++;
tot_bytes += frame->pkt_len;