diff options
author | Guy Harris <guy@alum.mit.edu> | 2014-09-20 11:30:57 -0700 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2014-09-20 18:31:28 +0000 |
commit | 32c38a4ecc7fc4f07349b0fbc13f7754be897546 (patch) | |
tree | 06b27c8e1cc30172de1f7ec765769e031a251e65 /wiretap/nettl.c | |
parent | 2cd9784f104234095a9c4a1eee4b4afcf3ad39d0 (diff) | |
download | wireshark-32c38a4ecc7fc4f07349b0fbc13f7754be897546.tar.gz |
Add file_error() calls after file_read().
If file_read() doesn't return the exact number of bytes you asked for,
and you really need all those bytes to be there, you have to call
file_error() to find out what the problem is.
Change-Id: I4cc87bc1b6cc5a49bbcbf93b56106f57af290d20
Reviewed-on: https://code.wireshark.org/review/4205
Reviewed-by: Guy Harris <guy@alum.mit.edu>
Diffstat (limited to 'wiretap/nettl.c')
-rw-r--r-- | wiretap/nettl.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/wiretap/nettl.c b/wiretap/nettl.c index 72cb1e22be..9fa6462fb7 100644 --- a/wiretap/nettl.c +++ b/wiretap/nettl.c @@ -235,6 +235,7 @@ int nettl_open(wtap *wth, int *err, gchar **err_info) /* read the first header to take a guess at the file encap */ bytes_read = file_read(dummy, 4, wth->fh); if (bytes_read != 4) { + *err = file_error(wth->fh, err_info); if (*err != 0) { return -1; } @@ -625,6 +626,7 @@ nettl_read_rec(wtap *wth, FILE_T fh, struct wtap_pkthdr *phdr, Buffer *buf, bytes_to_read = datalen; bytes_read = file_read(pd, bytes_to_read, fh); if (bytes_read != bytes_to_read) { + *err = file_error(wth->fh, err_info); if (*err == 0) *err = WTAP_ERR_SHORT_READ; return FALSE; @@ -641,6 +643,7 @@ nettl_read_rec(wtap *wth, FILE_T fh, struct wtap_pkthdr *phdr, Buffer *buf, bytes_to_read = datalen; bytes_read = file_read(dummy, bytes_to_read, fh); if (bytes_read != bytes_to_read) { + *err = file_error(wth->fh, err_info); if (*err == 0) *err = WTAP_ERR_SHORT_READ; return FALSE; |