diff options
author | Martin Storsjö <martin@martin.st> | 2012-05-30 18:35:05 +0400 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2012-06-01 16:25:15 +0400 |
commit | 2dbb8cc6a31b0e5b88e6ca667da097fa785e8917 (patch) | |
tree | c70db71c77d1837217781872bc542cc9eb700b3a /libavformat/tcp.c | |
parent | 5f509fa2e1ee91726a8fcfb8a2877edcc0895f8a (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.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/libavformat/tcp.c b/libavformat/tcp.c index db8dba2630..a8ebd81dc9 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); |