<p>Sean Bright has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.asterisk.org/6405">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/05/6405/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 3b2195a..e6ecd79 100644<br>--- a/formats/format_g719.c<br>+++ b/formats/format_g719.c<br>@@ -40,20 +40,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 fff6ed0..a88d132 100644<br>--- a/formats/format_g723.c<br>+++ b/formats/format_g723.c<br>@@ -40,7 +40,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>@@ -65,15 +65,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 33f9639..366f85d 100644<br>--- a/formats/format_g726.c<br>+++ b/formats/format_g726.c<br>@@ -117,22 +117,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 91dc855..324371c 100644<br>--- a/formats/format_g729.c<br>+++ b/formats/format_g729.c<br>@@ -46,20 +46,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 b737c97..70600b4 100644<br>--- a/formats/format_gsm.c<br>+++ b/formats/format_gsm.c<br>@@ -53,19 +53,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 586e2d8..97bca21 100644<br>--- a/formats/format_h263.c<br>+++ b/formats/format_h263.c<br>@@ -67,7 +67,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>@@ -85,15 +85,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 9230129..8860d88 100644<br>--- a/formats/format_h264.c<br>+++ b/formats/format_h264.c<br>@@ -59,7 +59,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>@@ -77,15 +77,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 8b41ab2..326a04e 100644<br>--- a/formats/format_ilbc.c<br>+++ b/formats/format_ilbc.c<br>@@ -45,19 +45,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 4891f7e..b4fd3b3 100644<br>--- a/formats/format_pcm.c<br>+++ b/formats/format_pcm.c<br>@@ -78,21 +78,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 e15e20f..d39096a 100644<br>--- a/formats/format_siren14.c<br>+++ b/formats/format_siren14.c<br>@@ -40,20 +40,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 298992c..8396750 100644<br>--- a/formats/format_siren7.c<br>+++ b/formats/format_siren7.c<br>@@ -40,20 +40,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 5a5cde7..20985ef 100644<br>--- a/formats/format_sln.c<br>+++ b/formats/format_sln.c<br>@@ -34,20 +34,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 c3da4ab..82379f6 100644<br>--- a/formats/format_vox.c<br>+++ b/formats/format_vox.c<br>@@ -40,20 +40,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 ce8a8bf..b4e1f34 100644<br>--- a/formats/format_wav.c<br>+++ b/formats/format_wav.c<br>@@ -369,7 +369,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>@@ -391,16 +391,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 8d7d87f..cd1cc6a 100644<br>--- a/formats/format_wav_gsm.c<br>+++ b/formats/format_wav_gsm.c<br>@@ -419,18 +419,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/6405">change 6405</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/6405"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: 15 </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: 6405 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Sean Bright <sean.bright@gmail.com> </div>