Make consumer verbose only with --verbose-consumer option
[lttng-tools.git] / lttng-consumerd / lttng-consumerd.c
index dce188aced643c282f71f4f7d114ad92f05374e8..e8e511702d1fefb755239d890d61d3b35975c070 100644 (file)
@@ -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");
This page took 0.035986 seconds and 4 git commands to generate.