case LTTNG_DST_IPV6:
DBG2("Setting network URI to consumer");
- consumer->type = CONSUMER_DST_NET;
-
- if ((uri->stype == LTTNG_STREAM_CONTROL &&
+ if (consumer->type == CONSUMER_DST_NET) {
+ if ((uri->stype == LTTNG_STREAM_CONTROL &&
consumer->dst.net.control_isset) ||
(uri->stype == LTTNG_STREAM_DATA &&
consumer->dst.net.data_isset)) {
- ret = LTTNG_ERR_URL_EXIST;
- goto error;
+ ret = LTTNG_ERR_URL_EXIST;
+ goto error;
+ }
+ } else {
+ memset(&consumer->dst.net, 0, sizeof(consumer->dst.net));
}
+ consumer->type = CONSUMER_DST_NET;
+
/* Set URI into consumer output object */
ret = consumer_set_network_uri(consumer, uri);
if (ret < 0) {
- ret = LTTNG_ERR_FATAL;
+ ret = -ret;
goto error;
} else if (ret == 1) {
/*
break;
}
+ ret = LTTNG_OK;
+
error:
return ret;
}
for (i = 0; i < nb_uri; i++) {
ret = add_uri_to_consumer(consumer, &uris[i], domain, session->name);
- if (ret < 0) {
+ if (ret != LTTNG_OK) {
goto error;
}
}
size_t nb_uri, lttng_sock_cred *creds)
{
int ret;
- char *path = NULL;
struct ltt_session *session;
assert(name);
}
/* Create tracing session in the registry */
- ret = session_create(name, path, LTTNG_SOCK_GET_UID_CRED(creds),
+ ret = session_create(name, LTTNG_SOCK_GET_UID_CRED(creds),
LTTNG_SOCK_GET_GID_CRED(creds));
if (ret != LTTNG_OK) {
goto session_error;
(ksess && ksess->consumer->type == CONSUMER_DST_NET) ||
(usess && usess->consumer->type == CONSUMER_DST_NET)) {
ret = build_network_session_path(sessions[i].path,
- sizeof(session[i].path), session);
+ sizeof(sessions[i].path), session);
} else {
- ret = snprintf(sessions[i].path, sizeof(session[i].path), "%s",
+ ret = snprintf(sessions[i].path, sizeof(sessions[i].path), "%s",
session->consumer->dst.trace_path);
}
if (ret < 0) {