From 3f7d0b63fcbbb995970f8c249e9202c8a2a9114a Mon Sep 17 00:00:00 2001 From: Sean Bright Date: Tue, 5 Sep 2017 11:05:48 -0400 Subject: formats: Restore previous fread() behavior Some formats are able to handle short reads while others are not, so restore the previous behavior for the format modules so that we don't have spurious errors when playing back files. ASTERISK-27232 #close Reported by: Jens T. Change-Id: Iab7f52b25a394f277566c8a2a4b15a692280a300 --- formats/format_siren7.c | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) (limited to 'formats/format_siren7.c') diff --git a/formats/format_siren7.c b/formats/format_siren7.c index 87e1372b3..f1bde0012 100644 --- a/formats/format_siren7.c +++ b/formats/format_siren7.c @@ -42,20 +42,15 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$") static struct ast_frame *siren7read(struct ast_filestream *s, int *whennext) { - int res; - /* Send a frame from the file to the appropriate channel */ + size_t res; + /* Send a frame from the file to the appropriate channel */ AST_FRAME_SET_BUFFER(&s->fr, s->buf, AST_FRIENDLY_OFFSET, BUF_SIZE); if ((res = fread(s->fr.data.ptr, 1, s->fr.datalen, s->f)) != s->fr.datalen) { - if (feof(s->f)) { - if (res) { - ast_debug(3, "Incomplete frame data at end of %s file " - "(expected %d bytes, read %d)\n", - ast_format_get_name(s->fr.subclass.format), s->fr.datalen, res); - } - } else { - ast_log(LOG_ERROR, "Error while reading %s file: %s\n", - ast_format_get_name(s->fr.subclass.format), strerror(errno)); + if (res) { + ast_log(LOG_WARNING, "Short read of %s data (expected %d bytes, read %zu): %s\n", + ast_format_get_name(s->fr.subclass.format), s->fr.datalen, res, + strerror(errno)); } return NULL; } -- cgit v1.2.3