Commit ef882e46 authored by Jordi Ortiz's avatar Jordi Ortiz Committed by Martin Storsjö

tcp: Pass NULL as hostname to getaddrinfo if the string is empty

This gives you the proper v4 or v6 version of the "any address",
allowing receiving connections on any address on the machine.
Signed-off-by: 's avatarMartin Storsjö <martin@martin.st>
parent 58f3e09e
......@@ -65,6 +65,9 @@ static int tcp_open(URLContext *h, const char *uri, int flags)
snprintf(portstr, sizeof(portstr), "%d", port);
if (listen_socket)
hints.ai_flags |= AI_PASSIVE;
if (!hostname[0])
ret = getaddrinfo(NULL, portstr, &hints, &ai);
else
ret = getaddrinfo(hostname, portstr, &hints, &ai);
if (ret) {
av_log(h, AV_LOG_ERROR,
......
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