diff options
author | Guy Harris <guy@alum.mit.edu> | 2011-04-12 03:27:10 +0000 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2011-04-12 03:27:10 +0000 |
commit | bbcb51276a1bd325cdc401a344004ce1e237b4c9 (patch) | |
tree | 81bb929e2e4c6b37fafcc84d2defd4bbfcf965c7 /wiretap/wtap.c | |
parent | b28ee8b33149385549f08fc009691773777180f5 (diff) | |
download | wireshark-bbcb51276a1bd325cdc401a344004ce1e237b4c9.tar.gz |
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
Diffstat (limited to 'wiretap/wtap.c')
-rw-r--r-- | wiretap/wtap.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/wiretap/wtap.c b/wiretap/wtap.c index 9b44e3a61b..a4b258f44b 100644 --- a/wiretap/wtap.c +++ b/wiretap/wtap.c @@ -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 |