diff options
author | Guy Harris <guy@alum.mit.edu> | 2016-04-18 18:27:39 -0700 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2016-04-19 01:28:17 +0000 |
commit | 378bdbfb3f49de5ebe9bd175c5a8e7698bc06a24 (patch) | |
tree | 65435df26cc42b507c9cf30ba9e8d63b6fc9307b /wiretap/mplog.c | |
parent | b13d9b64749ed45dfafee5ccc121e8c5dee4e062 (diff) |
Distinguish between read errors and short reads when opening.
Use wtap_read_bytes() which will return WTAP_ERR_SHORT_READ if we don't
get the specified number of bytes. Treat all errors *other* than
WTAP_ERR_SHORT_READ as an I/O error.
Change-Id: If38b5ad1b142441f2f2dd356be196bf381058da4
Reviewed-on: https://code.wireshark.org/review/14997
Reviewed-by: Guy Harris <guy@alum.mit.edu>
Diffstat (limited to 'wiretap/mplog.c')
-rw-r--r-- | wiretap/mplog.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/wiretap/mplog.c b/wiretap/mplog.c index 8db584188e..9e06a417d9 100644 --- a/wiretap/mplog.c +++ b/wiretap/mplog.c @@ -226,9 +226,12 @@ wtap_open_return_val mplog_open(wtap *wth, int *err, gchar **err_info _U_) gboolean ok; guint8 str[6]; - ok = wtap_read_bytes_or_eof(wth->fh, str, 6, err, err_info); - if (!ok) + ok = wtap_read_bytes(wth->fh, str, 6, err, err_info); + if (!ok) { + if (*err != WTAP_ERR_SHORT_READ) + return WTAP_OPEN_ERROR; return WTAP_OPEN_NOT_MINE; + } if (memcmp(str, "MPCSII", 6) != 0) return WTAP_OPEN_NOT_MINE; |