Module: libav
Branch: master
Commit: 641f4a885f141b8350076c9293ebd971dc984347

Author:    Martin Storsjö <[email protected]>
Committer: Martin Storsjö <[email protected]>
Date:      Wed May 30 17:35:05 2012 +0300

tcp: Check the return values from bind and accept

Signed-off-by: Martin Storsjö <[email protected]>

---

 libavformat/tcp.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)

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);

_______________________________________________
libav-commits mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-commits

Reply via email to