[FFmpeg-cvslog] tcp: Check the return values from bind and accept
Martin Storsjö
git at videolan.org
Fri Jun 1 20:05:36 CEST 2012
ffmpeg | branch: master | Martin Storsjö <martin at martin.st> | Wed May 30 17:35:05 2012 +0300| [641f4a885f141b8350076c9293ebd971dc984347] | committer: Martin Storsjö
tcp: Check the return values from bind and accept
Signed-off-by: Martin Storsjö <martin at martin.st>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=641f4a885f141b8350076c9293ebd971dc984347
---
libavformat/tcp.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/libavformat/tcp.c b/libavformat/tcp.c
index 37f74f6..e249e4e 100644
--- a/libavformat/tcp.c
+++ b/libavformat/tcp.c
@@ -84,8 +84,16 @@ static int tcp_open(URLContext *h, const char *uri, int flags)
if (listen_socket) {
int fd1;
ret = bind(fd, cur_ai->ai_addr, cur_ai->ai_addrlen);
+ if (ret) {
+ ret = ff_neterrno();
+ goto fail1;
+ }
listen(fd, 1);
fd1 = accept(fd, NULL, NULL);
+ if (fd1 < 0) {
+ ret = ff_neterrno();
+ goto fail1;
+ }
closesocket(fd);
fd = fd1;
ff_socket_nonblock(fd, 1);
More information about the ffmpeg-cvslog
mailing list