X-Git-Url: https://git.lttng.org/?a=blobdiff_plain;f=lttng-consumerd%2Flttng-consumerd.c;h=e8e511702d1fefb755239d890d61d3b35975c070;hb=f851868f8c7195682d13762719ce8f13293fd794;hp=dce188aced643c282f71f4f7d114ad92f05374e8;hpb=7753dea8e1af2342c4d42d2efc5da62538709ca8;p=lttng-tools.git diff --git a/lttng-consumerd/lttng-consumerd.c b/lttng-consumerd/lttng-consumerd.c index dce188ace..e8e511702 100644 --- a/lttng-consumerd/lttng-consumerd.c +++ b/lttng-consumerd/lttng-consumerd.c @@ -251,19 +251,26 @@ int main(int argc, char **argv) if (strlen(command_sock_path) == 0) { switch (opt_type) { case LTTNG_CONSUMER_KERNEL: - strcpy(command_sock_path, KCONSUMERD_CMD_SOCK_PATH); + snprintf(command_sock_path, PATH_MAX, KCONSUMERD_CMD_SOCK_PATH, + LTTNG_RUNDIR); break; case LTTNG_CONSUMER64_UST: - strcpy(command_sock_path, USTCONSUMERD64_CMD_SOCK_PATH); + snprintf(command_sock_path, PATH_MAX, + USTCONSUMERD64_CMD_SOCK_PATH, LTTNG_RUNDIR); break; case LTTNG_CONSUMER32_UST: - strcpy(command_sock_path, USTCONSUMERD32_CMD_SOCK_PATH); + snprintf(command_sock_path, PATH_MAX, + USTCONSUMERD32_CMD_SOCK_PATH, LTTNG_RUNDIR); break; default: WARN("Unknown consumerd type"); goto error; } } + + /* Init */ + lttng_consumer_init(); + /* create the consumer instance with and assign the callbacks */ ctx = lttng_consumer_create(opt_type, lttng_consumer_read_subbuffer, NULL, lttng_consumer_on_recv_stream, NULL); @@ -275,13 +282,16 @@ int main(int argc, char **argv) if (strlen(error_sock_path) == 0) { switch (opt_type) { case LTTNG_CONSUMER_KERNEL: - strcpy(error_sock_path, KCONSUMERD_ERR_SOCK_PATH); + snprintf(error_sock_path, PATH_MAX, KCONSUMERD_ERR_SOCK_PATH, + LTTNG_RUNDIR); break; case LTTNG_CONSUMER64_UST: - strcpy(error_sock_path, USTCONSUMERD64_ERR_SOCK_PATH); + snprintf(error_sock_path, PATH_MAX, + USTCONSUMERD64_ERR_SOCK_PATH, LTTNG_RUNDIR); break; case LTTNG_CONSUMER32_UST: - strcpy(error_sock_path, USTCONSUMERD32_ERR_SOCK_PATH); + snprintf(error_sock_path, PATH_MAX, + USTCONSUMERD32_ERR_SOCK_PATH, LTTNG_RUNDIR); break; default: WARN("Unknown consumerd type");