aboutsummaryrefslogtreecommitdiff
path: root/libavformat/tcp.c
diff options
context:
space:
mode:
authorMartin Storsjö2012-05-30 17:35:05 +0300
committerMartin Storsjö2012-06-01 01:56:21 +0300
commit641f4a885f141b8350076c9293ebd971dc984347 (patch)
tree581efa98a1c9e84794bafbea6e9b4819d036cbef /libavformat/tcp.c
parent5c742005fb7854dcfaa9f0efb65fd36a63ceaa2b (diff)
tcp: Check the return values from bind and accept
Signed-off-by: Martin Storsjö <martin@martin.st>
Diffstat (limited to 'libavformat/tcp.c')
-rw-r--r--libavformat/tcp.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/libavformat/tcp.c b/libavformat/tcp.c
index 37f74f6e2f..e249e4e830 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);