in_tgroup = lttng_check_tracing_group();
}
- if ((uid == 0) || in_tgroup) {
+ if ((uid == 0) || in_tgroup == 1) {
const int ret = lttng_strncpy(sessiond_sock_path,
DEFAULT_GLOBAL_CLIENT_UNIX_SOCK,
sizeof(sessiond_sock_path));
*/
int lttng_set_tracing_group(const char *name)
{
+ char *new_group;
if (name == NULL) {
return -LTTNG_ERR_INVALID;
}
- if (asprintf(&tracing_group, "%s", name) < 0) {
+ if (asprintf(&new_group, "%s", name) < 0) {
return -LTTNG_ERR_FATAL;
}
+ free(tracing_group);
+ tracing_group = new_group;
+ new_group = NULL;
+
return 0;
}