[FFmpeg-cvslog] tcp: Check the return values from bind and accept

Martin Storsjö git at videolan.org
Fri Jun 1 14:54:11 CEST 2012


ffmpeg | branch: master | Martin Storsjö <martin at martin.st> | Wed May 30 17:35:05 2012 +0300| [2dbb8cc6a31b0e5b88e6ca667da097fa785e8917] | committer: Michael Niedermayer

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=2dbb8cc6a31b0e5b88e6ca667da097fa785e8917
---

 libavformat/tcp.c |    8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/libavformat/tcp.c b/libavformat/tcp.c
index db8dba2..a8ebd81 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