summaryrefslogtreecommitdiff
path: root/libavformat/unix.c
diff options
context:
space:
mode:
authorBela Bodecs <bodecsb@vivanet.hu>2018-03-20 23:24:11 +0100
committerNicolas George <george@nsup.org>2018-03-21 19:02:06 +0100
commit1b45e6db22d979baa410645a1d5ab575175f1eb7 (patch)
tree8ed511b7d572d894fbccff3eda21db2f8a7fd9e0 /libavformat/unix.c
parent36cf3eb76a72058ea2d61c3d66e40d6929ca44d5 (diff)
downloadffmpeg-1b45e6db22d979baa410645a1d5ab575175f1eb7.tar.gz
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@vivanet.hu>
Diffstat (limited to 'libavformat/unix.c')
-rw-r--r--libavformat/unix.c2
1 files changed, 2 insertions, 0 deletions
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;
}