From f9a9a148622530cb02dbb81b31d951785f6d331a Mon Sep 17 00:00:00 2001 From: Jordi Ortiz Date: Tue, 24 Jul 2012 19:59:53 +0200 Subject: [PATCH] tcp: add port missing error message MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Without this patch a user a bit absent-minded may not notice that the connection doesn't work because the port is missing. Signed-off-by: Martin Storsjö --- libavformat/tcp.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/libavformat/tcp.c b/libavformat/tcp.c index 1d953e3a11..bdaab7f806 100644 --- a/libavformat/tcp.c +++ b/libavformat/tcp.c @@ -49,9 +49,12 @@ static int tcp_open(URLContext *h, const char *uri, int flags) av_url_split(proto, sizeof(proto), NULL, 0, hostname, sizeof(hostname), &port, path, sizeof(path), uri); - if (strcmp(proto,"tcp") || port <= 0 || port >= 65536) + if (strcmp(proto, "tcp")) return AVERROR(EINVAL); - + if (port <= 0 || port >= 65536) { + av_log(h, AV_LOG_ERROR, "Port missing in uri\n"); + return AVERROR(EINVAL); + } p = strchr(uri, '?'); if (p) { if (av_find_info_tag(buf, sizeof(buf), "listen", p))