<p>Sean Bright has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.asterisk.org/6403">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">formats: Restore previous fread() behavior<br><br>Some formats are able to handle short reads while others are not, so<br>restore the previous behavior for the format modules so that we don't<br>have spurious errors when playing back files.<br><br>ASTERISK-27232 #close<br>Reported by: Jens T.<br><br>Change-Id: Iab7f52b25a394f277566c8a2a4b15a692280a300<br>---<br>M formats/format_g719.c<br>M formats/format_g723.c<br>M formats/format_g726.c<br>M formats/format_g729.c<br>M formats/format_gsm.c<br>M formats/format_h263.c<br>M formats/format_h264.c<br>M formats/format_ilbc.c<br>M formats/format_pcm.c<br>M formats/format_siren14.c<br>M formats/format_siren7.c<br>M formats/format_sln.c<br>M formats/format_vox.c<br>M formats/format_wav.c<br>M formats/format_wav_gsm.c<br>15 files changed, 87 insertions(+), 161 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/03/6403/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">diff --git a/formats/format_g719.c b/formats/format_g719.c<br>index 6678585..e27822d 100644<br>--- a/formats/format_g719.c<br>+++ b/formats/format_g719.c<br>@@ -42,20 +42,15 @@<br> <br> static struct ast_frame *g719read(struct ast_filestream *s, int *whennext)<br> {<br>-        int res;<br>-     /* Send a frame from the file to the appropriate channel */<br>+  size_t res;<br> <br>+       /* Send a frame from the file to the appropriate channel */<br>   AST_FRAME_SET_BUFFER(&s->fr, s->buf, AST_FRIENDLY_OFFSET, BUF_SIZE);<br>        if ((res = fread(s->fr.data.ptr, 1, s->fr.datalen, s->f)) != s->fr.datalen) {<br>-            if (feof(s->f)) {<br>-                 if (res) {<br>-                           ast_debug(3, "Incomplete frame data at end of %s file "<br>-                                              "(expected %d bytes, read %d)\n",<br>-                                                  ast_format_get_name(s->fr.subclass.format), s->fr.datalen, res);<br>-                     }<br>-            } else {<br>-                     ast_log(LOG_ERROR, "Error while reading %s file: %s\n",<br>-                                    ast_format_get_name(s->fr.subclass.format), strerror(errno));<br>+             if (res) {<br>+                   ast_log(LOG_WARNING, "Short read of %s data (expected %d bytes, read %zu): %s\n",<br>+                                  ast_format_get_name(s->fr.subclass.format), s->fr.datalen, res,<br>+                                        strerror(errno));<br>             }<br>             return NULL;<br>  }<br>diff --git a/formats/format_g723.c b/formats/format_g723.c<br>index 1182124..9b77033 100644<br>--- a/formats/format_g723.c<br>+++ b/formats/format_g723.c<br>@@ -42,7 +42,7 @@<br> static struct ast_frame *g723_read(struct ast_filestream *s, int *whennext)<br> {<br>   unsigned short size;<br>- int res;<br>+     size_t res;<br>   int delay;<br>    /* Read the delay for the next packet, and schedule again if necessary */<br>     /* XXX is this ignored ? */<br>@@ -67,15 +67,10 @@<br>      /* Read the data into the buffer */<br>   AST_FRAME_SET_BUFFER(&s->fr, s->buf, AST_FRIENDLY_OFFSET, size);<br>    if ((res = fread(s->fr.data.ptr, 1, s->fr.datalen, s->f)) != s->fr.datalen) {<br>-            if (feof(s->f)) {<br>-                 if (res) {<br>-                           ast_debug(3, "Incomplete frame data at end of %s file "<br>-                                              "(expected %d bytes, read %d)\n",<br>-                                                  ast_format_get_name(s->fr.subclass.format), s->fr.datalen, res);<br>-                     }<br>-            } else {<br>-                     ast_log(LOG_ERROR, "Error while reading %s file: %s\n",<br>-                                    ast_format_get_name(s->fr.subclass.format), strerror(errno));<br>+             if (res) {<br>+                   ast_log(LOG_WARNING, "Short read of %s data (expected %d bytes, read %zu): %s\n",<br>+                                  ast_format_get_name(s->fr.subclass.format), s->fr.datalen, res,<br>+                                        strerror(errno));<br>             }<br>             return NULL;<br>  }<br>diff --git a/formats/format_g726.c b/formats/format_g726.c<br>index 94623f4..50b558e 100644<br>--- a/formats/format_g726.c<br>+++ b/formats/format_g726.c<br>@@ -119,22 +119,17 @@<br> <br> static struct ast_frame *g726_read(struct ast_filestream *s, int *whennext)<br> {<br>-   int res;<br>+     size_t res;<br>   struct g726_desc *fs = (struct g726_desc *)s->_private;<br> <br>         /* Send a frame from the file to the appropriate channel */<br>   AST_FRAME_SET_BUFFER(&s->fr, s->buf, AST_FRIENDLY_OFFSET, frame_size[fs->rate]);<br>         s->fr.samples = 8 * FRAME_TIME;<br>    if ((res = fread(s->fr.data.ptr, 1, s->fr.datalen, s->f)) != s->fr.datalen) {<br>-            if (feof(s->f)) {<br>-                 if (res) {<br>-                           ast_debug(3, "Incomplete frame data at end of %s file "<br>-                                              "(expected %d bytes, read %d)\n",<br>-                                                  ast_format_get_name(s->fr.subclass.format), s->fr.datalen, res);<br>-                     }<br>-            } else {<br>-                     ast_log(LOG_ERROR, "Error while reading %s file: %s\n",<br>-                                    ast_format_get_name(s->fr.subclass.format), strerror(errno));<br>+             if (res) {<br>+                   ast_log(LOG_WARNING, "Short read of %s data (expected %d bytes, read %zu): %s\n",<br>+                                  ast_format_get_name(s->fr.subclass.format), s->fr.datalen, res,<br>+                                        strerror(errno));<br>             }<br>             return NULL;<br>  }<br>diff --git a/formats/format_g729.c b/formats/format_g729.c<br>index 8436446..35c68bd 100644<br>--- a/formats/format_g729.c<br>+++ b/formats/format_g729.c<br>@@ -48,20 +48,16 @@<br> <br> static struct ast_frame *g729_read(struct ast_filestream *s, int *whennext)<br> {<br>-     int res;<br>+     size_t res;<br>+<br>        /* Send a frame from the file to the appropriate channel */<br>   s->fr.samples = G729A_SAMPLES;<br>     AST_FRAME_SET_BUFFER(&s->fr, s->buf, AST_FRIENDLY_OFFSET, BUF_SIZE);<br>        if ((res = fread(s->fr.data.ptr, 1, s->fr.datalen, s->f)) != s->fr.datalen) {<br>-            if (feof(s->f)) {<br>-                 if (res) {<br>-                           ast_debug(3, "Incomplete frame data at end of %s file "<br>-                                              "(expected %d bytes, read %d)\n",<br>-                                                  ast_format_get_name(s->fr.subclass.format), s->fr.datalen, res);<br>-                     }<br>-            } else {<br>-                     ast_log(LOG_ERROR, "Error while reading %s file: %s\n",<br>-                                    ast_format_get_name(s->fr.subclass.format), strerror(errno));<br>+             if (res && res != 10) /* XXX what for ? */ {<br>+                 ast_log(LOG_WARNING, "Short read of %s data (expected %d bytes, read %zu): %s\n",<br>+                                  ast_format_get_name(s->fr.subclass.format), s->fr.datalen, res,<br>+                                        strerror(errno));<br>             }<br>             return NULL;<br>  }<br>diff --git a/formats/format_gsm.c b/formats/format_gsm.c<br>index cfc9452..783d955 100644<br>--- a/formats/format_gsm.c<br>+++ b/formats/format_gsm.c<br>@@ -55,19 +55,14 @@<br> <br> static struct ast_frame *gsm_read(struct ast_filestream *s, int *whennext)<br> {<br>-  int res;<br>+     size_t res;<br> <br>        AST_FRAME_SET_BUFFER(&(s->fr), s->buf, AST_FRIENDLY_OFFSET, GSM_FRAME_SIZE);<br>        if ((res = fread(s->fr.data.ptr, 1, GSM_FRAME_SIZE, s->f)) != GSM_FRAME_SIZE) {<br>-                if (feof(s->f)) {<br>-                 if (res) {<br>-                           ast_debug(3, "Incomplete frame data at end of %s file "<br>-                                              "(expected %d bytes, read %d)\n",<br>-                                                  ast_format_get_name(s->fr.subclass.format), GSM_FRAME_SIZE, res);<br>-                       }<br>-            } else {<br>-                     ast_log(LOG_ERROR, "Error while reading %s file: %s\n",<br>-                                    ast_format_get_name(s->fr.subclass.format), strerror(errno));<br>+             if (res) {<br>+                   ast_log(LOG_WARNING, "Short read of %s data (expected %d bytes, read %zu): %s\n",<br>+                                  ast_format_get_name(s->fr.subclass.format), GSM_FRAME_SIZE, res,<br>+                                  strerror(errno));<br>             }<br>             return NULL;<br>  }<br>diff --git a/formats/format_h263.c b/formats/format_h263.c<br>index 5d59972..be8e1df 100644<br>--- a/formats/format_h263.c<br>+++ b/formats/format_h263.c<br>@@ -69,7 +69,7 @@<br> <br> static struct ast_frame *h263_read(struct ast_filestream *s, int *whennext)<br> {<br>-       int res;<br>+     size_t res;<br>   uint32_t mark;<br>        unsigned short len;<br>   unsigned int ts;<br>@@ -87,15 +87,10 @@<br>         }<br>     AST_FRAME_SET_BUFFER(&s->fr, s->buf, AST_FRIENDLY_OFFSET, len);<br>     if ((res = fread(s->fr.data.ptr, 1, s->fr.datalen, s->f)) != s->fr.datalen) {<br>-            if (feof(s->f)) {<br>-                 if (res) {<br>-                           ast_debug(3, "Incomplete frame data at end of %s file "<br>-                                              "(expected %d bytes, read %d)\n",<br>-                                                  ast_format_get_name(s->fr.subclass.format), s->fr.datalen, res);<br>-                     }<br>-            } else {<br>-                     ast_log(LOG_ERROR, "Error while reading %s file: %s\n",<br>-                                    ast_format_get_name(s->fr.subclass.format), strerror(errno));<br>+             if (res) {<br>+                   ast_log(LOG_WARNING, "Short read of %s data (expected %d bytes, read %zu): %s\n",<br>+                                  ast_format_get_name(s->fr.subclass.format), s->fr.datalen, res,<br>+                                        strerror(errno));<br>             }<br>             return NULL;<br>  }<br>diff --git a/formats/format_h264.c b/formats/format_h264.c<br>index f8906f4..3060400 100644<br>--- a/formats/format_h264.c<br>+++ b/formats/format_h264.c<br>@@ -61,7 +61,7 @@<br> <br> static struct ast_frame *h264_read(struct ast_filestream *s, int *whennext)<br> {<br>-       int res;<br>+     size_t res;<br>   int mark = 0;<br>         unsigned short len;<br>   unsigned int ts;<br>@@ -79,15 +79,10 @@<br>         }<br>     AST_FRAME_SET_BUFFER(&s->fr, s->buf, AST_FRIENDLY_OFFSET, len);<br>     if ((res = fread(s->fr.data.ptr, 1, s->fr.datalen, s->f)) != s->fr.datalen) {<br>-            if (feof(s->f)) {<br>-                 if (res) {<br>-                           ast_debug(3, "Incomplete frame data at end of %s file "<br>-                                              "(expected %d bytes, read %d)\n",<br>-                                                  ast_format_get_name(s->fr.subclass.format), s->fr.datalen, res);<br>-                     }<br>-            } else {<br>-                     ast_log(LOG_ERROR, "Error while reading %s file: %s\n",<br>-                                    ast_format_get_name(s->fr.subclass.format), strerror(errno));<br>+             if (res) {<br>+                   ast_log(LOG_WARNING, "Short read of %s data (expected %d bytes, read %zu): %s\n",<br>+                                  ast_format_get_name(s->fr.subclass.format), s->fr.datalen, res,<br>+                                        strerror(errno));<br>             }<br>             return NULL;<br>  }<br>diff --git a/formats/format_ilbc.c b/formats/format_ilbc.c<br>index 6e06ef3..d4fbe96 100644<br>--- a/formats/format_ilbc.c<br>+++ b/formats/format_ilbc.c<br>@@ -47,19 +47,15 @@<br> <br> static struct ast_frame *ilbc_read(struct ast_filestream *s, int *whennext)<br> {<br>-     int res;<br>+     size_t res;<br>+<br>        /* Send a frame from the file to the appropriate channel */<br>   AST_FRAME_SET_BUFFER(&s->fr, s->buf, AST_FRIENDLY_OFFSET, ILBC_BUF_SIZE);<br>   if ((res = fread(s->fr.data.ptr, 1, s->fr.datalen, s->f)) != s->fr.datalen) {<br>-            if (feof(s->f)) {<br>-                 if (res) {<br>-                           ast_debug(3, "Incomplete frame data at end of %s file "<br>-                                              "(expected %d bytes, read %d)\n",<br>-                                                  ast_format_get_name(s->fr.subclass.format), s->fr.datalen, res);<br>-                     }<br>-            } else {<br>-                     ast_log(LOG_ERROR, "Error while reading %s file: %s\n",<br>-                                    ast_format_get_name(s->fr.subclass.format), strerror(errno));<br>+             if (res) {<br>+                   ast_log(LOG_WARNING, "Short read of %s data (expected %d bytes, read %zu): %s\n",<br>+                                  ast_format_get_name(s->fr.subclass.format), s->fr.datalen, res,<br>+                                        strerror(errno));<br>             }<br>             return NULL;<br>  }<br>diff --git a/formats/format_pcm.c b/formats/format_pcm.c<br>index bd7cf77..7b06482 100644<br>--- a/formats/format_pcm.c<br>+++ b/formats/format_pcm.c<br>@@ -80,21 +80,15 @@<br> <br> static struct ast_frame *pcm_read(struct ast_filestream *s, int *whennext)<br> {<br>-  int res;<br>-     <br>-     /* Send a frame from the file to the appropriate channel */<br>+  size_t res;<br> <br>+       /* Send a frame from the file to the appropriate channel */<br>   AST_FRAME_SET_BUFFER(&s->fr, s->buf, AST_FRIENDLY_OFFSET, BUF_SIZE);<br>-       if ((res = fread(s->fr.data.ptr, 1, s->fr.datalen, s->f)) != s->fr.datalen) {<br>-            if (feof(s->f)) {<br>-                 if (res) {<br>-                           ast_debug(3, "Incomplete frame data at end of %s file "<br>-                                              "(expected %d bytes, read %d)\n",<br>-                                                  ast_format_get_name(s->fr.subclass.format), s->fr.datalen, res);<br>-                     }<br>-            } else {<br>-                     ast_log(LOG_ERROR, "Error while reading %s file: %s\n",<br>-                                    ast_format_get_name(s->fr.subclass.format), strerror(errno));<br>+     if ((res = fread(s->fr.data.ptr, 1, s->fr.datalen, s->f)) < 1) {<br>+         if (res) {<br>+                   ast_log(LOG_WARNING, "Short read of %s data (expected %d bytes, read %zu): %s\n",<br>+                                  ast_format_get_name(s->fr.subclass.format), s->fr.datalen, res,<br>+                                        strerror(errno));<br>             }<br>             return NULL;<br>  }<br>diff --git a/formats/format_siren14.c b/formats/format_siren14.c<br>index 5aaa1f1..3e42bef 100644<br>--- a/formats/format_siren14.c<br>+++ b/formats/format_siren14.c<br>@@ -42,20 +42,15 @@<br> <br> static struct ast_frame *siren14read(struct ast_filestream *s, int *whennext)<br> {<br>-       int res;<br>-     /* Send a frame from the file to the appropriate channel */<br>+  size_t res;<br> <br>+       /* Send a frame from the file to the appropriate channel */<br>   AST_FRAME_SET_BUFFER(&s->fr, s->buf, AST_FRIENDLY_OFFSET, BUF_SIZE);<br>        if ((res = fread(s->fr.data.ptr, 1, s->fr.datalen, s->f)) != s->fr.datalen) {<br>-            if (feof(s->f)) {<br>-                 if (res) {<br>-                           ast_debug(3, "Incomplete frame data at end of %s file "<br>-                                              "(expected %d bytes, read %d)\n",<br>-                                                  ast_format_get_name(s->fr.subclass.format), s->fr.datalen, res);<br>-                     }<br>-            } else {<br>-                     ast_log(LOG_ERROR, "Error while reading %s file: %s\n",<br>-                                    ast_format_get_name(s->fr.subclass.format), strerror(errno));<br>+             if (res) {<br>+                   ast_log(LOG_WARNING, "Short read of %s data (expected %d bytes, read %zu): %s\n",<br>+                                  ast_format_get_name(s->fr.subclass.format), s->fr.datalen, res,<br>+                                        strerror(errno));<br>             }<br>             return NULL;<br>  }<br>diff --git a/formats/format_siren7.c b/formats/format_siren7.c<br>index 87e1372..f1bde00 100644<br>--- a/formats/format_siren7.c<br>+++ b/formats/format_siren7.c<br>@@ -42,20 +42,15 @@<br> <br> static struct ast_frame *siren7read(struct ast_filestream *s, int *whennext)<br> {<br>-    int res;<br>-     /* Send a frame from the file to the appropriate channel */<br>+  size_t res;<br> <br>+       /* Send a frame from the file to the appropriate channel */<br>   AST_FRAME_SET_BUFFER(&s->fr, s->buf, AST_FRIENDLY_OFFSET, BUF_SIZE);<br>        if ((res = fread(s->fr.data.ptr, 1, s->fr.datalen, s->f)) != s->fr.datalen) {<br>-            if (feof(s->f)) {<br>-                 if (res) {<br>-                           ast_debug(3, "Incomplete frame data at end of %s file "<br>-                                              "(expected %d bytes, read %d)\n",<br>-                                                  ast_format_get_name(s->fr.subclass.format), s->fr.datalen, res);<br>-                     }<br>-            } else {<br>-                     ast_log(LOG_ERROR, "Error while reading %s file: %s\n",<br>-                                    ast_format_get_name(s->fr.subclass.format), strerror(errno));<br>+             if (res) {<br>+                   ast_log(LOG_WARNING, "Short read of %s data (expected %d bytes, read %zu): %s\n",<br>+                                  ast_format_get_name(s->fr.subclass.format), s->fr.datalen, res,<br>+                                        strerror(errno));<br>             }<br>             return NULL;<br>  }<br>diff --git a/formats/format_sln.c b/formats/format_sln.c<br>index 2f4cc57..48bad8a 100644<br>--- a/formats/format_sln.c<br>+++ b/formats/format_sln.c<br>@@ -36,20 +36,15 @@<br> <br> static struct ast_frame *generic_read(struct ast_filestream *s, int *whennext, unsigned int buf_size)<br> {<br>-       int res;<br>-     /* Send a frame from the file to the appropriate channel */<br>+  size_t res;<br> <br>+       /* Send a frame from the file to the appropriate channel */<br>   AST_FRAME_SET_BUFFER(&s->fr, s->buf, AST_FRIENDLY_OFFSET, buf_size);<br>-       if ((res = fread(s->fr.data.ptr, 1, s->fr.datalen, s->f)) != s->fr.datalen) {<br>-            if (feof(s->f)) {<br>-                 if (res) {<br>-                           ast_debug(3, "Incomplete frame data at end of %s file "<br>-                                              "(expected %d bytes, read %d)\n",<br>-                                                  ast_format_get_name(s->fr.subclass.format), s->fr.datalen, res);<br>-                     }<br>-            } else {<br>-                     ast_log(LOG_ERROR, "Error while reading %s file: %s\n",<br>-                                    ast_format_get_name(s->fr.subclass.format), strerror(errno));<br>+     if ((res = fread(s->fr.data.ptr, 1, s->fr.datalen, s->f)) < 1) {<br>+         if (res) {<br>+                   ast_log(LOG_WARNING, "Short read of %s data (expected %d bytes, read %zu): %s\n",<br>+                                  ast_format_get_name(s->fr.subclass.format), s->fr.datalen, res,<br>+                                        strerror(errno));<br>             }<br>             return NULL;<br>  }<br>diff --git a/formats/format_vox.c b/formats/format_vox.c<br>index 26d4169..813dabf 100644<br>--- a/formats/format_vox.c<br>+++ b/formats/format_vox.c<br>@@ -42,20 +42,15 @@<br> <br> static struct ast_frame *vox_read(struct ast_filestream *s, int *whennext)<br> {<br>-  int res;<br>+     size_t res;<br> <br>        /* Send a frame from the file to the appropriate channel */<br>   AST_FRAME_SET_BUFFER(&s->fr, s->buf, AST_FRIENDLY_OFFSET, BUF_SIZE);<br>-       if ((res = fread(s->fr.data.ptr, 1, s->fr.datalen, s->f)) != s->fr.datalen) {<br>-            if (feof(s->f)) {<br>-                 if (res) {<br>-                           ast_debug(3, "Incomplete frame data at end of %s file "<br>-                                              "(expected %d bytes, read %d)\n",<br>-                                                  ast_format_get_name(s->fr.subclass.format), s->fr.datalen, res);<br>-                     }<br>-            } else {<br>-                     ast_log(LOG_ERROR, "Error while reading %s file: %s\n",<br>-                                    ast_format_get_name(s->fr.subclass.format), strerror(errno));<br>+     if ((res = fread(s->fr.data.ptr, 1, s->fr.datalen, s->f)) < 1) {<br>+         if (res) {<br>+                   ast_log(LOG_WARNING, "Short read of %s data (expected %d bytes, read %zu): %s\n",<br>+                                  ast_format_get_name(s->fr.subclass.format), s->fr.datalen, res,<br>+                                        strerror(errno));<br>             }<br>             return NULL;<br>  }<br>diff --git a/formats/format_wav.c b/formats/format_wav.c<br>index 2903992..cead61c 100644<br>--- a/formats/format_wav.c<br>+++ b/formats/format_wav.c<br>@@ -371,7 +371,7 @@<br> <br> static struct ast_frame *wav_read(struct ast_filestream *s, int *whennext)<br> {<br>-  int res;<br>+     size_t res;<br>   int samples;    /* actual samples read */<br> #if __BYTE_ORDER == __BIG_ENDIAN<br>  int x;<br>@@ -393,16 +393,11 @@<br> /*      ast_debug(1, "here: %d, maxlen: %d, bytes: %d\n", here, s->maxlen, bytes); */<br>    AST_FRAME_SET_BUFFER(&s->fr, s->buf, AST_FRIENDLY_OFFSET, bytes);<br> <br>-       if ((res = fread(s->fr.data.ptr, 1, s->fr.datalen, s->f)) != s->fr.datalen) {<br>-            if (feof(s->f)) {<br>-                 if (res) {<br>-                           ast_debug(3, "Incomplete frame data at end of %s file "<br>-                                              "(expected %d bytes, read %d)\n",<br>-                                                  ast_format_get_name(s->fr.subclass.format), s->fr.datalen, res);<br>-                     }<br>-            } else {<br>-                     ast_log(LOG_ERROR, "Error while reading %s file: %s\n",<br>-                                    ast_format_get_name(s->fr.subclass.format), strerror(errno));<br>+     if ((res = fread(s->fr.data.ptr, 1, s->fr.datalen, s->f)) == 0) {<br>+           if (res) {<br>+                   ast_log(LOG_WARNING, "Short read of %s data (expected %d bytes, read %zu): %s\n",<br>+                                  ast_format_get_name(s->fr.subclass.format), s->fr.datalen, res,<br>+                                        strerror(errno));<br>             }<br>             return NULL;<br>  }<br>diff --git a/formats/format_wav_gsm.c b/formats/format_wav_gsm.c<br>index 2f80a9a..423dfe4 100644<br>--- a/formats/format_wav_gsm.c<br>+++ b/formats/format_wav_gsm.c<br>@@ -421,18 +421,13 @@<br>     } else {<br>              /* read and convert */<br>                unsigned char msdata[MSGSM_FRAME_SIZE];<br>-              int res;<br>-             <br>+             size_t res;<br>+<br>                if ((res = fread(msdata, 1, MSGSM_FRAME_SIZE, s->f)) != MSGSM_FRAME_SIZE) {<br>-                       if (feof(s->f)) {<br>-                         if (res) {<br>-                                   ast_debug(3, "Incomplete frame data at end of %s file "<br>-                                                      "(expected %d bytes, read %d)\n",<br>-                                                          ast_format_get_name(s->fr.subclass.format), MSGSM_FRAME_SIZE, res);<br>-                             }<br>-                    } else {<br>-                             ast_log(LOG_ERROR, "Error while reading %s file: %s\n",<br>-                                            ast_format_get_name(s->fr.subclass.format), strerror(errno));<br>+                     if (res && res != 1) {<br>+                               ast_log(LOG_WARNING, "Short read of %s data (expected %d bytes, read %zu): %s\n",<br>+                                          ast_format_get_name(s->fr.subclass.format), MSGSM_FRAME_SIZE, res,<br>+                                                strerror(errno));<br>                     }<br>                     return NULL;<br>          }<br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/6403">change 6403</a>. To unsubscribe, visit <a href="https://gerrit.asterisk.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.asterisk.org/6403"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: 13 </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>
<div style="display:none"> Gerrit-Change-Id: Iab7f52b25a394f277566c8a2a4b15a692280a300 </div>
<div style="display:none"> Gerrit-Change-Number: 6403 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Sean Bright <sean.bright@gmail.com> </div>