Check for "wtap_seek_read()" failing.
authorGuy Harris <guy@alum.mit.edu>
Wed, 3 Sep 2003 23:32:40 +0000 (23:32 -0000)
committerGuy Harris <guy@alum.mit.edu>
Wed, 3 Sep 2003 23:32:40 +0000 (23:32 -0000)
svn path=/trunk/; revision=8364

gtk/main.c
gtk/tap_rtp.c
gtk/tcp_graph.c
proto_hier_stats.c

index 8cbe7080ebf9dcc131505cc1454f2202946b0091..9bfa5f107984220b776319ee930117890f7bb0db 100644 (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,
index d015e5b3b1225766c4ddc0b9ce3eb7eef1467584..b0ddfeb44dffe90782065197bbc27be69f82a46f 100644 (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);
index 7ad8bf668c13f90506375bfff208e99c88bb64c5..9d5539e55f8c1268a0a62cb8e3ae4b072c2f65b9 100644 (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)
index 9ff7041c6016b628790648f4b684187f688b7e6f..70898297f108fc9649eae6312a8aad6009406f5a 100644 (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;