aboutsummaryrefslogtreecommitdiffstats
path: root/wiretap/mp2t.c
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2014-10-07 15:48:29 -0700
committerGuy Harris <guy@alum.mit.edu>2014-10-07 22:48:57 +0000
commit5e0e4fa9e4de39f9402e6472e6b25439f8464c24 (patch)
treeeb71d15d2232db30a018058530c4c4cd25cad351 /wiretap/mp2t.c
parentd6f217f62db4ec66e4b702ae2b751510563bb475 (diff)
Replace another file_read() call with wtap_read_bytes().
Change-Id: I7b5e82c3a2fc4b4c16bf466508546558c584c150 Reviewed-on: https://code.wireshark.org/review/4539 Reviewed-by: Guy Harris <guy@alum.mit.edu>
Diffstat (limited to 'wiretap/mp2t.c')
-rw-r--r--wiretap/mp2t.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/wiretap/mp2t.c b/wiretap/mp2t.c
index 324b1dfc2e..5337d1d35b 100644
--- a/wiretap/mp2t.c
+++ b/wiretap/mp2t.c
@@ -144,7 +144,6 @@ mp2t_seek_read(wtap *wth, gint64 seek_off, struct wtap_pkthdr *phdr,
int
mp2t_open(wtap *wth, int *err, gchar **err_info)
{
- int bytes_read;
guint8 buffer[MP2T_SIZE+TRAILER_LEN_MAX];
guint8 trailer_len = 0;
guint sync_steps = 0;
@@ -176,13 +175,10 @@ mp2t_open(wtap *wth, int *err, gchar **err_info)
}
/* read some packets and make sure they all start with a sync byte */
do {
- bytes_read = file_read(buffer, MP2T_SIZE+trailer_len, wth->fh);
- if (bytes_read < 0) {
- *err = file_error(wth->fh, err_info);
- return -1; /* read error */
- }
- if (bytes_read < MP2T_SIZE+trailer_len) {
- if(sync_steps<2) return 0; /* wrong file type - not an mpeg2 ts file */
+ if (!wtap_read_bytes(wth->fh, buffer, MP2T_SIZE+trailer_len, err, err_info)) {
+ if (*err != WTAP_ERR_SHORT_READ)
+ return -1; /* read error */
+ if(sync_steps<2) return 0; /* wrong file type - not an mpeg2 ts file */
break; /* end of file, that's ok if we're still in sync */
}
if (buffer[0] == MP2T_SYNC_BYTE) {