Module: libav
Branch: master
Commit: bb6c1abb0e022e1edaa5b3d8bb5abdff4f0c0ff2

Author:    Martin Storsjö <[email protected]>
Committer: Martin Storsjö <[email protected]>
Date:      Tue Jun 19 17:50:38 2012 +0300

tcp: Check the return value from getsockopt

Make sure we actually have an error code in ret, in case
getsockopt failed.

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

---

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

diff --git a/libavformat/tcp.c b/libavformat/tcp.c
index e7c6210..f1bad84 100644
--- a/libavformat/tcp.c
+++ b/libavformat/tcp.c
@@ -139,7 +139,8 @@ static int tcp_open(URLContext *h, const char *uri, int 
flags)
         }
         /* test error */
         optlen = sizeof(ret);
-        getsockopt (fd, SOL_SOCKET, SO_ERROR, &ret, &optlen);
+        if (getsockopt (fd, SOL_SOCKET, SO_ERROR, &ret, &optlen))
+            ret = AVUNERROR(ff_neterrno());
         if (ret != 0) {
             char errbuf[100];
             ret = AVERROR(ret);

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

Reply via email to