X-Git-Url: https://git.lttng.org/?p=lttng-tools.git;a=blobdiff_plain;f=src%2Fbin%2Flttng-sessiond%2Fconsumer.c;h=d3c561c9ec6932531fc3c46a1a464835dc45e12f;hp=36883766955e07847503236d7f62334364033c33;hb=10a5031171c7bca5b4498c871b119e5a88b6a3fb;hpb=618a6a28c0956fc6829c165a39ffec97f239096c diff --git a/src/bin/lttng-sessiond/consumer.c b/src/bin/lttng-sessiond/consumer.c index 368837669..d3c561c9e 100644 --- a/src/bin/lttng-sessiond/consumer.c +++ b/src/bin/lttng-sessiond/consumer.c @@ -28,7 +28,6 @@ #include #include #include -#include #include "consumer.h" #include "health.h" @@ -752,9 +751,11 @@ void consumer_init_ask_channel_comm_msg(struct lttcomm_consumer_msg *msg, memcpy(msg->u.ask_channel.uuid, uuid, sizeof(msg->u.ask_channel.uuid)); - strncpy(msg->u.ask_channel.pathname, pathname, - sizeof(msg->u.ask_channel.pathname)); - msg->u.ask_channel.pathname[sizeof(msg->u.ask_channel.pathname)-1] = '\0'; + if (pathname) { + strncpy(msg->u.ask_channel.pathname, pathname, + sizeof(msg->u.ask_channel.pathname)); + msg->u.ask_channel.pathname[sizeof(msg->u.ask_channel.pathname)-1] = '\0'; + } strncpy(msg->u.ask_channel.name, name, sizeof(msg->u.ask_channel.name)); msg->u.ask_channel.name[sizeof(msg->u.ask_channel.name) - 1] = '\0'; @@ -1198,7 +1199,6 @@ int consumer_snapshot_channel(struct consumer_socket *socket, uint64_t key, const char *session_path, int wait) { int ret; - char datetime[16]; struct lttcomm_consumer_msg msg; assert(socket); @@ -1208,13 +1208,6 @@ int consumer_snapshot_channel(struct consumer_socket *socket, uint64_t key, DBG("Consumer snapshot channel key %" PRIu64, key); - ret = utils_get_current_time_str("%Y%m%d-%H%M%S", datetime, - sizeof(datetime)); - if (!ret) { - ret = -EINVAL; - goto error; - } - memset(&msg, 0, sizeof(msg)); msg.cmd_type = LTTNG_CONSUMER_SNAPSHOT_CHANNEL; msg.u.snapshot_channel.key = key; @@ -1226,7 +1219,7 @@ int consumer_snapshot_channel(struct consumer_socket *socket, uint64_t key, msg.u.snapshot_channel.use_relayd = 1; ret = snprintf(msg.u.snapshot_channel.pathname, sizeof(msg.u.snapshot_channel.pathname), "%s/%s-%s%s", - output->consumer->subdir, output->name, datetime, + output->consumer->subdir, output->name, output->datetime, session_path); if (ret < 0) { ret = -LTTNG_ERR_NOMEM; @@ -1235,8 +1228,8 @@ int consumer_snapshot_channel(struct consumer_socket *socket, uint64_t key, } else { ret = snprintf(msg.u.snapshot_channel.pathname, sizeof(msg.u.snapshot_channel.pathname), "%s/%s-%s%s", - output->consumer->dst.trace_path, output->name, datetime, - session_path); + output->consumer->dst.trace_path, output->name, + output->datetime, session_path); if (ret < 0) { ret = -LTTNG_ERR_NOMEM; goto error;