summaryrefslogtreecommitdiff
path: root/libavformat/tcp.c
diff options
context:
space:
mode:
authorMartin Storsjö <martin@martin.st>2012-06-19 17:50:38 +0300
committerMartin Storsjö <martin@martin.st>2012-06-19 20:25:07 +0300
commitbb6c1abb0e022e1edaa5b3d8bb5abdff4f0c0ff2 (patch)
tree14059fa897529441e1dc7dc8a5f011032b2c500d /libavformat/tcp.c
parenta840cdda6cf7dbfe6858739f718d2ede9e3c375b (diff)
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ö <martin@martin.st>
Diffstat (limited to 'libavformat/tcp.c')
-rw-r--r--libavformat/tcp.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/libavformat/tcp.c b/libavformat/tcp.c
index e7c6210fc1..f1bad847d0 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);