summaryrefslogtreecommitdiff
path: root/libavformat/tcp.c
diff options
context:
space:
mode:
authorwm4 <nfxjfg@googlemail.com>2017-12-30 17:44:03 +0100
committerwm4 <nfxjfg@googlemail.com>2017-12-31 16:14:23 +0100
commit0e1f771d2200d14d298df09c91e14f51e418fd3a (patch)
tree57602ee07d32971fa06bfe60387bcc0831f46c96 /libavformat/tcp.c
parente45f7bca735ff7ba965ec1e441199dc7aeb0c8fc (diff)
downloadffmpeg-0e1f771d2200d14d298df09c91e14f51e418fd3a.tar.gz
tcp: properly return EOF
There is no POSIX error code for EOF - recv() signals EOF by simply returning 0. But libavformat recently changed its conventions and requires an explicit AVERROR_EOF, or it might get into an endless retry loop, consuming 100% CPU while doing nothing.
Diffstat (limited to 'libavformat/tcp.c')
-rw-r--r--libavformat/tcp.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/libavformat/tcp.c b/libavformat/tcp.c
index fef0729da6..8773493df1 100644
--- a/libavformat/tcp.c
+++ b/libavformat/tcp.c
@@ -225,6 +225,8 @@ static int tcp_read(URLContext *h, uint8_t *buf, int size)
return ret;
}
ret = recv(s->fd, buf, size, 0);
+ if (ret == 0)
+ return AVERROR_EOF;
return ret < 0 ? ff_neterrno() : ret;
}