summaryrefslogtreecommitdiff
path: root/wiretap/iseries.c
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2013-05-17 09:37:02 +0000
committerGuy Harris <guy@alum.mit.edu>2013-05-17 09:37:02 +0000
commitadb9282b0e0b56fc4980c1908d649d41ce6df223 (patch)
treed812efae34afcd2743d8ba4d0909f218b897af16 /wiretap/iseries.c
parent13694fde7b527200330753bcbebf0e65e1f2d438 (diff)
downloadwireshark-adb9282b0e0b56fc4980c1908d649d41ce6df223.tar.gz
If iseries_seek_next_packet() hits the EOF, *err will be set to 0; just
have it return -1 for errors or EOF, and have iseries_read() check for a negative return value and return FALSE. That simplifies it a bit, and handles the "no more records in the file" case (iseries_seek_next_packet() will hit EOF and return -1 with *err set to 0, which is what the callers of a read routine expect at EOF). Get rid of duplicate (and incorrect before the change) comment. svn path=/trunk/; revision=49375
Diffstat (limited to 'wiretap/iseries.c')
-rw-r--r--wiretap/iseries.c18
1 files changed, 5 insertions, 13 deletions
diff --git a/wiretap/iseries.c b/wiretap/iseries.c
index 45911b2fac..51dfd1062c 100644
--- a/wiretap/iseries.c
+++ b/wiretap/iseries.c
@@ -383,7 +383,7 @@ iseries_read (wtap * wth, int *err, gchar ** err_info, gint64 *data_offset)
* Locate the next packet
*/
offset = iseries_seek_next_packet (wth, err, err_info);
- if (offset < 1)
+ if (offset < 0)
return FALSE;
/*
@@ -401,8 +401,9 @@ iseries_read (wtap * wth, int *err, gchar ** err_info, gint64 *data_offset)
/*
* Seeks to the beginning of the next packet, and returns the
- * byte offset. Returns -1 on failure, and sets *err to the error
- * and *err_info to null or an additional error string.
+ * byte offset. Returns -1 on failure or EOF; on EOF, sets
+ * *err to 0, and, on failure, sets *err to the error and *err_info
+ * to null or an additional error string.
*/
static gint64
iseries_seek_next_packet (wtap * wth, int *err, gchar **err_info)
@@ -413,22 +414,13 @@ iseries_seek_next_packet (wtap * wth, int *err, gchar **err_info)
gint64 cur_off;
long buflen;
- /*
- * Seeks to the beginning of the next packet, and returns the
- * byte offset. Returns -1 on failure, and sets *err to the error
- * and *err_info to null or an additional error string.
- */
for (line = 0; line < ISERIES_MAX_TRACE_LEN; line++)
{
if (file_gets (buf, ISERIES_LINE_LENGTH, wth->fh) == NULL)
{
/* EOF or error. */
*err = file_error (wth->fh, err_info);
- if (*err != 0)
- {
- return -1;
- }
- return 0;
+ return -1;
}
/* Convert UNICODE to ASCII if required and determine */
/* the number of bytes to rewind to beginning of record. */