[FFmpeg-cvslog] avformat/unix: fix handling of EOF in case of SOCK_STREAM.

Bela Bodecs git at videolan.org
Wed Mar 21 21:09:40 EET 2018


ffmpeg | branch: master | Bela Bodecs <bodecsb at vivanet.hu> | Tue Mar 20 23:24:11 2018 +0100| [1b45e6db22d979baa410645a1d5ab575175f1eb7] | committer: Nicolas George

avformat/unix: fix handling of EOF in case of SOCK_STREAM.

When recv() returns 0 in case of SOCK_STREAM type, it means EOF and with
this patch returns value accordingly.

Signed-off-by: Bela Bodecs <bodecsb at vivanet.hu>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=1b45e6db22d979baa410645a1d5ab575175f1eb7
---

 libavformat/unix.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/libavformat/unix.c b/libavformat/unix.c
index 4f01d14a93..38016dbafe 100644
--- a/libavformat/unix.c
+++ b/libavformat/unix.c
@@ -111,6 +111,8 @@ static int unix_read(URLContext *h, uint8_t *buf, int size)
             return ret;
     }
     ret = recv(s->fd, buf, size, 0);
+    if (!ret && s->type == SOCK_STREAM)
+        return AVERROR_EOF;
     return ret < 0 ? ff_neterrno() : ret;
 }
 



More information about the ffmpeg-cvslog mailing list