Clean-up: uri_parse_str_urls: assert on invalid uri_parse() return values
[lttng-tools.git] / src / common / uri.c
index 0f20c61b8eb13efe51f7c2185a0e1623b74995aa..0f89468c54f3c0f10aa1610df592a6d430a4bd27 100644 (file)
@@ -126,7 +126,7 @@ static int set_ip_address(const char *addr, int af, char *dst, size_t size)
                         * We choose to use the system name resolution API first
                         * to honor its network configuration. If this fails, we
                         * resolve to the appropriate loopback address. This is
-                        * done to accomodate systems which may want to start
+                        * done to accommodates systems which may want to start
                         * tracing before their network configured.
                         */
                        const char *loopback_addr = af == AF_INET ?
@@ -577,6 +577,9 @@ ssize_t uri_parse_str_urls(const char *ctrl_url, const char *data_url,
                        goto parse_error;
                }
 
+               /* 1 and 2 are the only expected values on success. */
+               assert(size_ctrl == 1 || size_ctrl == 2);
+
                /* At this point, we know there is at least one URI in the array */
                set_default_uri_attr(&ctrl_uris[0], LTTNG_STREAM_CONTROL);
 
@@ -614,6 +617,9 @@ ssize_t uri_parse_str_urls(const char *ctrl_url, const char *data_url,
                } else if (size_data == 2) {
                        ERR("Data URL can not be set with the net[4|6]:// protocol");
                        goto error;
+               } else {
+                       /* 1 and 2 are the only expected values on success. */
+                       assert(size_data == 1);
                }
 
                set_default_uri_attr(&data_uris[0], LTTNG_STREAM_DATA);
This page took 0.023988 seconds and 4 git commands to generate.