[FFmpeg-cvslog] tcp: add port missing error message

Jordi Ortiz git at videolan.org
Wed Jul 25 22:13:29 CEST 2012


ffmpeg | branch: master | Jordi Ortiz <nenjordi at gmail.com> | Tue Jul 24 19:59:53 2012 +0200| [f9a9a148622530cb02dbb81b31d951785f6d331a] | committer: Martin Storsjö

tcp: add port missing error message

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ö <martin at martin.st>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=f9a9a148622530cb02dbb81b31d951785f6d331a
---

 libavformat/tcp.c |    7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/libavformat/tcp.c b/libavformat/tcp.c
index 1d953e3..bdaab7f 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))



More information about the ffmpeg-cvslog mailing list