aboutsummaryrefslogtreecommitdiffstats
path: root/wiretap/ascend.c
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2002-03-05 05:58:41 +0000
committerGuy Harris <guy@alum.mit.edu>2002-03-05 05:58:41 +0000
commite300f4db52ddfcdfbf8a53d69d88e037365cb7a3 (patch)
treeedc94f3db1aa4b8d5dfc6192d153023fb32d9a0d /wiretap/ascend.c
parenta7553a55864b398593c9e3c922d91ae804e0d732 (diff)
Have "wtap_seek_read()" return 0 on success and -1 on failure, and take
an "err" argument that points to an "int" into which to put an error code if it fails. Check for errors in one call to it, and note that we should do so in other places. In the "wtap_seek_read()" call in the TCP graphing code, don't overwrite "cfile.pseudo_header", and make the buffer into which we read the data WTAP_MAX_PACKET_SIZE bytes, as it should be. In some of the file readers for text files, check for errors from the "parse the record header" and "parse the hex dump" routines when reading sequentially. In "csids_seek_read()", fix some calls to "file_error()" to check the error on the random stream (that being what we're reading). svn path=/trunk/; revision=4874
Diffstat (limited to 'wiretap/ascend.c')
-rw-r--r--wiretap/ascend.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/wiretap/ascend.c b/wiretap/ascend.c
index 25e75546e8..1f93052025 100644
--- a/wiretap/ascend.c
+++ b/wiretap/ascend.c
@@ -1,6 +1,6 @@
/* ascend.c
*
- * $Id: ascend.c,v 1.27 2002/03/04 00:25:35 guy Exp $
+ * $Id: ascend.c,v 1.28 2002/03/05 05:58:40 guy Exp $
*
* Wiretap Library
* Copyright (c) 1998 by Gilbert Ramirez <gram@alumni.rice.edu>
@@ -103,7 +103,7 @@ static const char ascend_w2magic[] = { 'W', 'D', '_', 'D', 'I', 'A', 'L', 'O', '
static gboolean ascend_read(wtap *wth, int *err, long *data_offset);
static int ascend_seek_read (wtap *wth, long seek_off,
- union wtap_pseudo_header *pseudo_header, guint8 *pd, int len);
+ union wtap_pseudo_header *pseudo_header, guint8 *pd, int len, int *err);
static void ascend_close(wtap *wth);
/* Seeks to the beginning of the next packet, and returns the
@@ -341,10 +341,17 @@ static gboolean ascend_read(wtap *wth, int *err, long *data_offset)
}
static int ascend_seek_read (wtap *wth, long seek_off,
- union wtap_pseudo_header *pseudo_header, guint8 *pd, int len)
+ union wtap_pseudo_header *pseudo_header, guint8 *pd, int len, int *err)
{
- file_seek(wth->random_fh, seek_off, SEEK_SET);
- return parse_ascend(wth->random_fh, pd, &pseudo_header->ascend, NULL, len);
+ if (file_seek(wth->random_fh, seek_off, SEEK_SET) == -1) {
+ *err = file_error(wth->random_fh);
+ return -1;
+ }
+ if (! parse_ascend(wth->random_fh, pd, &pseudo_header->ascend, NULL, len)) {
+ *err = WTAP_ERR_BAD_RECORD;
+ return -1;
+ }
+ return 0;
}
static void ascend_close(wtap *wth)