Commit 2dbb8cc6 authored by Martin Storsjö's avatar Martin Storsjö Committed by Michael Niedermayer

tcp: Check the return values from bind and accept

Signed-off-by: 's avatarMartin Storsjö <martin@martin.st>
parent 5f509fa2
......@@ -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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment