diff options
-rw-r--r-- | libavformat/tcp.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/libavformat/tcp.c b/libavformat/tcp.c index 5313195e5c..6a65860b5f 100644 --- a/libavformat/tcp.c +++ b/libavformat/tcp.c @@ -65,7 +65,10 @@ 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; - ret = getaddrinfo(hostname, portstr, &hints, &ai); + if (!hostname[0]) + ret = getaddrinfo(NULL, portstr, &hints, &ai); + else + ret = getaddrinfo(hostname, portstr, &hints, &ai); if (ret) { av_log(h, AV_LOG_ERROR, "Failed to resolve hostname %s: %s\n", |