Fix: quiet option is not set in sessiond-config
[lttng-tools.git] / src / bin / lttng-sessiond / main.c
index 10802aa7b2cc66d87d0946ee53623b05b47a1c0f..313e66e76cf965049fd5491410ae4c4c718a477a 100644 (file)
@@ -1270,6 +1270,7 @@ restart:
        if (!cmd_socket_wrapper) {
                goto error;
        }
+       cmd_socket_wrapper->lock = &consumer_data->lock;
 
        ret = consumer_send_channel_monitor_pipe(cmd_socket_wrapper,
                        consumer_data->channel_monitor_pipe);
@@ -2413,9 +2414,9 @@ static pid_t spawn_consumerd(struct consumer_data *consumer_data)
                         * fallback on the 32-bit one,
                         */
                        DBG3("Looking for a kernel consumer at these locations:");
-                       DBG3("  1) %s", config.consumerd64_bin_path.value);
+                       DBG3("  1) %s", config.consumerd64_bin_path.value ? : "NULL");
                        DBG3("  2) %s/%s", INSTALL_BIN_PATH, DEFAULT_CONSUMERD_FILE);
-                       DBG3("  3) %s", config.consumerd32_bin_path.value);
+                       DBG3("  3) %s", config.consumerd32_bin_path.value ? : "NULL");
                        if (stat(config.consumerd64_bin_path.value, &st) == 0) {
                                DBG3("Found location #1");
                                consumer_to_use = config.consumerd64_bin_path.value;
@@ -2442,7 +2443,7 @@ static pid_t spawn_consumerd(struct consumer_data *consumer_data)
                {
                        char *tmpnew = NULL;
 
-                       if (config.consumerd64_lib_dir.value[0] != '\0') {
+                       if (config.consumerd64_lib_dir.value) {
                                char *tmp;
                                size_t tmplen;
 
@@ -2450,20 +2451,18 @@ static pid_t spawn_consumerd(struct consumer_data *consumer_data)
                                if (!tmp) {
                                        tmp = "";
                                }
-                               tmplen = strlen("LD_LIBRARY_PATH=")
-                                       + strlen(config.consumerd64_lib_dir.value) + 1 /* : */ + strlen(tmp);
+                               tmplen = strlen(config.consumerd64_lib_dir.value) + 1 /* : */ + strlen(tmp);
                                tmpnew = zmalloc(tmplen + 1 /* \0 */);
                                if (!tmpnew) {
                                        ret = -ENOMEM;
                                        goto error;
                                }
-                               strcpy(tmpnew, "LD_LIBRARY_PATH=");
                                strcat(tmpnew, config.consumerd64_lib_dir.value);
                                if (tmp[0] != '\0') {
                                        strcat(tmpnew, ":");
                                        strcat(tmpnew, tmp);
                                }
-                               ret = putenv(tmpnew);
+                               ret = setenv("LD_LIBRARY_PATH", tmpnew, 1);
                                if (ret) {
                                        ret = -errno;
                                        free(tmpnew);
@@ -2476,16 +2475,14 @@ static pid_t spawn_consumerd(struct consumer_data *consumer_data)
                                        "--consumerd-err-sock", consumer_data->err_unix_sock_path,
                                        "--group", config.tracing_group_name.value,
                                        NULL);
-                       if (config.consumerd64_lib_dir.value[0] != '\0') {
-                               free(tmpnew);
-                       }
+                       free(tmpnew);
                        break;
                }
                case LTTNG_CONSUMER32_UST:
                {
                        char *tmpnew = NULL;
 
-                       if (config.consumerd32_lib_dir.value[0] != '\0') {
+                       if (config.consumerd32_lib_dir.value) {
                                char *tmp;
                                size_t tmplen;
 
@@ -2493,20 +2490,18 @@ static pid_t spawn_consumerd(struct consumer_data *consumer_data)
                                if (!tmp) {
                                        tmp = "";
                                }
-                               tmplen = strlen("LD_LIBRARY_PATH=")
-                                       + strlen(config.consumerd32_lib_dir.value) + 1 /* : */ + strlen(tmp);
+                               tmplen = strlen(config.consumerd32_lib_dir.value) + 1 /* : */ + strlen(tmp);
                                tmpnew = zmalloc(tmplen + 1 /* \0 */);
                                if (!tmpnew) {
                                        ret = -ENOMEM;
                                        goto error;
                                }
-                               strcpy(tmpnew, "LD_LIBRARY_PATH=");
                                strcat(tmpnew, config.consumerd32_lib_dir.value);
                                if (tmp[0] != '\0') {
                                        strcat(tmpnew, ":");
                                        strcat(tmpnew, tmp);
                                }
-                               ret = putenv(tmpnew);
+                               ret = setenv("LD_LIBRARY_PATH", tmpnew, 1);
                                if (ret) {
                                        ret = -errno;
                                        free(tmpnew);
@@ -2519,13 +2514,11 @@ static pid_t spawn_consumerd(struct consumer_data *consumer_data)
                                        "--consumerd-err-sock", consumer_data->err_unix_sock_path,
                                        "--group", config.tracing_group_name.value,
                                        NULL);
-                       if (config.consumerd32_lib_dir.value[0] != '\0') {
-                               free(tmpnew);
-                       }
+                       free(tmpnew);
                        break;
                }
                default:
-                       PERROR("unknown consumer type");
+                       ERR("unknown consumer type");
                        exit(EXIT_FAILURE);
                }
                if (errno != 0) {
@@ -4727,7 +4720,7 @@ static int set_option(int opt, const char *arg, const char *optname)
        } else if (string_match(optname, "no-kernel")) {
                config.no_kernel = true;
        } else if (string_match(optname, "quiet") || opt == 'q') {
-               lttng_opt_quiet = true;
+               config.quiet = true;
        } else if (string_match(optname, "verbose") || opt == 'v') {
                /* Verbose level can increase using multiple -v */
                if (arg) {
@@ -5584,12 +5577,13 @@ int main(int argc, char **argv)
        /* Check if daemon is UID = 0 */
        is_root = !getuid();
 
+       if (create_lttng_rundir()) {
+               retval = -1;
+               goto exit_init_data;
+       }
+
        if (is_root) {
                /* Create global run dir with root access */
-               if (create_lttng_rundir()) {
-                       retval = -1;
-                       goto exit_init_data;
-               }
 
                kernel_channel_monitor_pipe = lttng_pipe_open(0);
                if (!kernel_channel_monitor_pipe) {
This page took 0.025465 seconds and 4 git commands to generate.