From: David Goulet Date: Tue, 19 Jun 2012 14:49:01 +0000 (-0400) Subject: Fix: problem in port assignment in uri_parse() X-Git-Tag: v2.1.0-rc1~108 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=b35d8a5714e1e4b989237d1d117fba3364c24299;p=lttng-tools.git Fix: problem in port assignment in uri_parse() The functions now puts 0 in the port field of the lttng_uri structure if NO port are specified. It's now the caller's job to assign a default port for that case. Since the uri_parse() function does not know the URI context, a default port can not be assigned correctly. Signed-off-by: David Goulet --- diff --git a/src/common/uri.c b/src/common/uri.c index 3a58aedca..cb04d1963 100644 --- a/src/common/uri.c +++ b/src/common/uri.c @@ -145,17 +145,17 @@ ssize_t uri_parse(const char *str_uri, struct lttng_uri **uris) /* Size of the uris array. Default is 1 */ ssize_t size = 1; char net[6], dst[LTTNG_MAX_DNNAME + 1]; - unsigned int ctrl_port = DEFAULT_NETWORK_CONTROL_PORT; - unsigned int data_port = DEFAULT_NETWORK_DATA_PORT; + unsigned int ctrl_port = 0; + unsigned int data_port = 0; struct lttng_uri *uri; const struct uri_proto *proto; /* * The first part is the protocol portion of a maximum of 5 bytes for now. - * (tcp, tcp6, udp, udp6, file, net). The second part is the hostname or IP - * address. The 255 bytes size is the limit found in the RFC 1035 for the - * total length of a domain name (https://www.ietf.org/rfc/rfc1035.txt). - * Finally, with the net:// protocol, two ports can be specified. + * The second part is the hostname or IP address. The 255 bytes size is the + * limit found in the RFC 1035 for the total length of a domain name + * (https://www.ietf.org/rfc/rfc1035.txt). Finally, for the net:// + * protocol, two ports CAN be specified. */ ret = sscanf(str_uri, "%5[^:]://", net);