X-Git-Url: http://git.liburcu.org/?a=blobdiff_plain;f=src%2Fbin%2Flttng-sessiond%2Fmain.c;h=577936a89ff2d8f1e09aa68c14a4052f8581efe0;hb=d7458e2fdfda5824bb5406c8e05dc48276bf433f;hp=88877c700437d54713020f4dc06c66f543fe4d67;hpb=56c170703d909f138d941d44a2525f000d45ebf1;p=lttng-tools.git diff --git a/src/bin/lttng-sessiond/main.c b/src/bin/lttng-sessiond/main.c index 88877c700..577936a89 100644 --- a/src/bin/lttng-sessiond/main.c +++ b/src/bin/lttng-sessiond/main.c @@ -547,15 +547,9 @@ static void sessiond_cleanup(void) */ utils_close_pipe(thread_quit_pipe); - /* - * If config.pid_file_path.value is undefined, the default file will be - * wiped when removing the rundir. - */ - if (config.pid_file_path.value) { - ret = remove(config.pid_file_path.value); - if (ret < 0) { - PERROR("remove pidfile %s", config.pid_file_path.value); - } + ret = remove(config.pid_file_path.value); + if (ret < 0) { + PERROR("remove pidfile %s", config.pid_file_path.value); } DBG("Removing sessiond and consumerd content of directory %s", @@ -2442,7 +2436,8 @@ static pid_t spawn_consumerd(struct consumer_data *consumer_data) } else if (stat(INSTALL_BIN_PATH "/" DEFAULT_CONSUMERD_FILE, &st) == 0) { DBG3("Found location #2"); consumer_to_use = INSTALL_BIN_PATH "/" DEFAULT_CONSUMERD_FILE; - } else if (stat(config.consumerd32_bin_path.value, &st) == 0) { + } else if (config.consumerd32_bin_path.value && + stat(config.consumerd32_bin_path.value, &st) == 0) { DBG3("Found location #3"); consumer_to_use = config.consumerd32_bin_path.value; } else { @@ -4116,9 +4111,17 @@ static void *thread_manage_health(void *data) } if (is_root) { + gid_t gid; + /* lttng health client socket path permissions */ + ret = utils_get_group_id(config.tracing_group_name.value, true, + &gid); + if (ret) { + /* Default to root group. */ + gid = 0; + } ret = chown(config.health_unix_sock_path.value, 0, - utils_get_group_id(config.tracing_group_name.value)); + gid); if (ret < 0) { ERR("Unable to set group on %s", config.health_unix_sock_path.value); PERROR("chown"); @@ -5243,7 +5246,11 @@ static int set_permissions(char *rundir) int ret; gid_t gid; - gid = utils_get_group_id(config.tracing_group_name.value); + ret = utils_get_group_id(config.tracing_group_name.value, true, &gid); + if (ret) { + /* Default to root group. */ + gid = 0; + } /* Set lttng run dir */ ret = chown(rundir, 0, gid); @@ -5354,7 +5361,16 @@ static int set_consumer_sockets(struct consumer_data *consumer_data) goto error; } if (is_root) { - ret = chown(path, 0, utils_get_group_id(config.tracing_group_name.value)); + gid_t gid; + + ret = utils_get_group_id(config.tracing_group_name.value, true, + &gid); + if (ret) { + /* Default to root group. */ + gid = 0; + } + + ret = chown(path, 0, gid); if (ret < 0) { ERR("Unable to set group on %s", path); PERROR("chown");