diff options
author | Guy Harris <guy@alum.mit.edu> | 2003-05-27 10:14:06 +0000 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2003-05-27 10:14:06 +0000 |
commit | fdb0e20f13fcd7fc653f3893c27ea013fec95ec1 (patch) | |
tree | 7e3abaf92b4e39dc24852ac6930ee35634e37086 /wiretap/vms.c | |
parent | bc24ddab678cf3ad0b6dfaedd3685f436f9f637c (diff) |
Make "vms_check_file_type()" seek back to the beginning of the line that
matched if it succeeds, so that it gets re-read when we read the capture
file - it's a line containing a time stamp for a packet, so we need to
re-read it to get that time stamp.
svn path=/trunk/; revision=7752
Diffstat (limited to 'wiretap/vms.c')
-rw-r--r-- | wiretap/vms.c | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/wiretap/vms.c b/wiretap/vms.c index 60402eed52..3dc505859a 100644 --- a/wiretap/vms.c +++ b/wiretap/vms.c @@ -1,6 +1,6 @@ /* vms.c * - * $Id: vms.c,v 1.18 2003/05/20 20:17:03 guy Exp $ + * $Id: vms.c,v 1.19 2003/05/27 10:14:06 guy Exp $ * * Wiretap Library * Copyright (c) 2001 by Marc Milgram <ethereal@mmilgram.NOSPAMmail.net> @@ -208,10 +208,17 @@ static gboolean vms_check_file_type(wtap *wth, int *err) { char buf[VMS_LINE_LENGTH]; guint reclen, line; + long mpos; buf[VMS_LINE_LENGTH-1] = '\0'; for (line = 0; line < VMS_HEADER_LINES_TO_CHECK; line++) { + mpos = file_tell(wth->fh); + if (mpos == -1) { + /* Error. */ + *err = file_error(wth->fh); + return FALSE; + } if (file_gets(buf, VMS_LINE_LENGTH, wth->fh) != NULL) { reclen = strlen(buf); @@ -224,6 +231,12 @@ static gboolean vms_check_file_type(wtap *wth, int *err) if (strstr(buf, VMS_HDR_MAGIC_STR1) || strstr(buf, VMS_HDR_MAGIC_STR2) || strstr(buf, VMS_HDR_MAGIC_STR3)) { + /* Go back to the beginning of this line, so we will + * re-read it. */ + if (file_seek(wth->fh, mpos, SEEK_SET, err) == -1) { + /* Error. */ + return FALSE; + } return TRUE; } } else { |