diff mbox series

[FFmpeg-devel,v2,6/6] avformat/rtsp: fix the error code from ffurl_read_complete()

Message ID 1638765904-2521-6-git-send-email-lance.lmwang@gmail.com
State New
Headers show
Series [FFmpeg-devel,v2,1/6] avformat/rtsp: remove redundant assignment
Related show

Checks

Context Check Description
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished
andriy/make_ppc success Make finished
andriy/make_fate_ppc success Make fate finished

Commit Message

Limin Wang Dec. 6, 2021, 4:45 a.m. UTC
From: Limin Wang <lance.lmwang@gmail.com>

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
---
 libavformat/rtsp.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Comments

Martin Storsjö Dec. 7, 2021, 9:31 a.m. UTC | #1
On Mon, 6 Dec 2021, lance.lmwang@gmail.com wrote:

> From: Limin Wang <lance.lmwang@gmail.com>
>
> Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
> ---
> libavformat/rtsp.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c
> index 4ae810d..c591664 100644
> --- a/libavformat/rtsp.c
> +++ b/libavformat/rtsp.c
> @@ -1197,7 +1197,7 @@ start:
>             ret = ffurl_read_complete(rt->rtsp_hd, &ch, 1);
>             av_log(s, AV_LOG_TRACE, "ret=%d c=%02x [%c]\n", ret, ch, ch);
>             if (ret != 1)
> -                return AVERROR_EOF;
> +                return ret < 0 ? ret : AVERROR(EIO);
>             if (ch == '\n')
>                 break;
>             if (ch == '$' && q == buf) {
> @@ -1250,9 +1250,9 @@ start:
>         content = av_malloc(content_length + 1);
>         if (!content)
>             return AVERROR(ENOMEM);
> -        if (ffurl_read_complete(rt->rtsp_hd, content, content_length) != content_length) {
> +        if ((ret = ffurl_read_complete(rt->rtsp_hd, content, content_length)) != content_length) {
>             av_freep(&content);
> -            return AVERROR(EIO);
> +            return ret < 0 ? ret : AVERROR(EIO);
>         }
>         content[content_length] = '\0';
>         *content_ptr = content;
> -- 
> 1.8.3.1

Ok

// Martin
diff mbox series

Patch

diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c
index 4ae810d..c591664 100644
--- a/libavformat/rtsp.c
+++ b/libavformat/rtsp.c
@@ -1197,7 +1197,7 @@  start:
             ret = ffurl_read_complete(rt->rtsp_hd, &ch, 1);
             av_log(s, AV_LOG_TRACE, "ret=%d c=%02x [%c]\n", ret, ch, ch);
             if (ret != 1)
-                return AVERROR_EOF;
+                return ret < 0 ? ret : AVERROR(EIO);
             if (ch == '\n')
                 break;
             if (ch == '$' && q == buf) {
@@ -1250,9 +1250,9 @@  start:
         content = av_malloc(content_length + 1);
         if (!content)
             return AVERROR(ENOMEM);
-        if (ffurl_read_complete(rt->rtsp_hd, content, content_length) != content_length) {
+        if ((ret = ffurl_read_complete(rt->rtsp_hd, content, content_length)) != content_length) {
             av_freep(&content);
-            return AVERROR(EIO);
+            return ret < 0 ? ret : AVERROR(EIO);
         }
         content[content_length] = '\0';
         *content_ptr = content;