- strcpy(ctx->session_name, "lttng-ptrace-");
- pid = getpid();
- ret = sprintf(pid_str, "%d", (int) pid);
- if (ret < 0)
- return -1;
- strcat(ctx->session_name, pid_str);
+ strncpy(ctx->session_name, cmd_name, LTTNG_NAME_MAX - 1);
+ ctx->session_name[LTTNG_NAME_MAX - 1] = '\0';