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@martin.st>
This commit is contained in:
		
				
					committed by
					
						
						Martin Storsjö
					
				
			
			
				
	
			
			
			
						parent
						
							49c45a2624
						
					
				
				
					commit
					f9a9a14862
				
			@@ -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),
 | 
					    av_url_split(proto, sizeof(proto), NULL, 0, hostname, sizeof(hostname),
 | 
				
			||||||
        &port, path, sizeof(path), uri);
 | 
					        &port, path, sizeof(path), uri);
 | 
				
			||||||
    if (strcmp(proto,"tcp") || port <= 0 || port >= 65536)
 | 
					    if (strcmp(proto, "tcp"))
 | 
				
			||||||
        return AVERROR(EINVAL);
 | 
					        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, '?');
 | 
					    p = strchr(uri, '?');
 | 
				
			||||||
    if (p) {
 | 
					    if (p) {
 | 
				
			||||||
        if (av_find_info_tag(buf, sizeof(buf), "listen", p))
 | 
					        if (av_find_info_tag(buf, sizeof(buf), "listen", p))
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user