[FFmpeg-devel] lavf/tcp: return EOF on read, but not 0

Submitted by Takayuki 'January June' Suwa on Oct. 21, 2017, 3:24 a.m.

Details

Message ID 1508556280-27888-1-git-send-email-jjsuwa.sys3175@gmail.com
State New
Headers show

Commit Message

Takayuki 'January June' Suwa Oct. 21, 2017, 3:24 a.m.
related to commit '858db4b01fa2b55ee55056c033054ca54ac9b0fd'.

---
 libavformat/tcp.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

Patch hide | download patch | download mbox

diff --git a/libavformat/tcp.c b/libavformat/tcp.c
index 07b4ed9..5438122 100644
--- a/libavformat/tcp.c
+++ b/libavformat/tcp.c
@@ -220,7 +220,12 @@  static int tcp_read(URLContext *h, uint8_t *buf, int size)
             return ret;
     }
     ret = recv(s->fd, buf, size, 0);
-    return ret < 0 ? ff_neterrno() : ret;
+    if (ret < 0)
+        return ff_neterrno();
+    else if (ret == 0)
+        return AVERROR_EOF;
+    else
+        return ret;
 }
 
 static int tcp_write(URLContext *h, const uint8_t *buf, int size)