If we hit an EOF - wth->subtype_read returns FALSE, but sets *err to 0 -

call file_error() to fetch any deferred error, so we report an error
rather than an "everything's OK" EOF.

svn path=/trunk/; revision=36578
This commit is contained in:
Guy Harris 2011-04-12 03:27:10 +00:00
parent b28ee8b331
commit bbcb51276a
1 changed files with 13 additions and 1 deletions

View File

@ -724,8 +724,20 @@ wtap_read(wtap *wth, int *err, gchar **err_info, gint64 *data_offset)
*/
wth->phdr.pkt_encap = wth->file_encap;
if (!wth->subtype_read(wth, err, err_info, data_offset))
if (!wth->subtype_read(wth, err, err_info, data_offset)) {
/*
* If we didn't get an error indication, we read
* the last packet. See if there's any deferred
* error, as might, for example, occur if we're
* reading a compressed file, and we got an error
* reading compressed data from the file, but
* got enough compressed data to decompress the
* last packet of the file.
*/
if (*err == 0)
*err = file_error(wth->fh);
return FALSE; /* failure */
}
/*
* It makes no sense for the captured data length to be bigger