In the NetMon capture file reading code, if we get a short read when
trying to read the frame table, return -1 with "*err" set to WTAP_ERR_SHORT_READ, don't return 0 - we've already decided that the file is a NetMon file, so we shouldn't return a "this isn't a NetMon file" indication, we should return a "this file is too short" error, as that's what the problem is. Fix up the error messages for WTAP_ERR_SHORT_READ to indicate that the read might have gotten cut short in the middle of data other than a packet. svn path=/trunk/; revision=4331
This commit is contained in:
parent
445203577c
commit
2174f26cdc
4
file.c
4
file.c
|
@ -1,7 +1,7 @@
|
|||
/* file.c
|
||||
* File I/O routines
|
||||
*
|
||||
* $Id: file.c,v 1.248 2001/11/21 23:16:21 gram Exp $
|
||||
* $Id: file.c,v 1.249 2001/12/04 23:38:53 guy Exp $
|
||||
*
|
||||
* Ethereal - Network traffic analyzer
|
||||
* By Gerald Combs <gerald@ethereal.com>
|
||||
|
@ -1895,7 +1895,7 @@ file_open_error_message(int err, gboolean for_writing)
|
|||
|
||||
case WTAP_ERR_SHORT_READ:
|
||||
errmsg = "The file \"%s\" appears to have been cut short"
|
||||
" in the middle of a packet.";
|
||||
" in the middle of a packet or other data.";
|
||||
break;
|
||||
|
||||
case WTAP_ERR_SHORT_WRITE:
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/* tethereal.c
|
||||
*
|
||||
* $Id: tethereal.c,v 1.101 2001/12/04 08:25:55 guy Exp $
|
||||
* $Id: tethereal.c,v 1.102 2001/12/04 23:38:53 guy Exp $
|
||||
*
|
||||
* Ethereal - Network traffic analyzer
|
||||
* By Gerald Combs <gerald@ethereal.com>
|
||||
|
@ -1641,7 +1641,7 @@ file_open_error_message(int err, gboolean for_writing)
|
|||
|
||||
case WTAP_ERR_SHORT_READ:
|
||||
errmsg = "The file \"%s\" appears to have been cut short"
|
||||
" in the middle of a packet.";
|
||||
" in the middle of a packet or other data.";
|
||||
break;
|
||||
|
||||
case WTAP_ERR_SHORT_WRITE:
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/* netmon.c
|
||||
*
|
||||
* $Id: netmon.c,v 1.43 2001/11/13 23:55:43 gram Exp $
|
||||
* $Id: netmon.c,v 1.44 2001/12/04 23:38:55 guy Exp $
|
||||
*
|
||||
* Wiretap Library
|
||||
* Copyright (c) 1998 by Gilbert Ramirez <gram@alumni.rice.edu>
|
||||
|
@ -254,9 +254,9 @@ int netmon_open(wtap *wth, int *err)
|
|||
bytes_read = file_read(frame_table, 1, frame_table_length, wth->fh);
|
||||
if ((guint32)bytes_read != frame_table_length) {
|
||||
*err = file_error(wth->fh);
|
||||
if (*err != 0)
|
||||
return -1;
|
||||
return 0;
|
||||
if (*err == 0)
|
||||
*err = WTAP_ERR_SHORT_READ;
|
||||
return -1;
|
||||
}
|
||||
wth->capture.netmon->frame_table_size = frame_table_size;
|
||||
wth->capture.netmon->frame_table = frame_table;
|
||||
|
|
Loading…
Reference in New Issue