- if (opt_output_path != NULL) {
- traces_path = utils_expand_path(opt_output_path);
- if (traces_path == NULL) {
- ret = CMD_ERROR;
- goto error;
- }
-
- /* Create URL string from the local file system path */
- ret = asprintf(&alloc_url, "file://%s", traces_path);
- if (ret < 0) {
- PERROR("asprintf url path");
- ret = CMD_FATAL;
- goto error;
- }
- /* URL to use in the lttng_create_session() call */
- url = alloc_url;
- print_str_url = traces_path;
- } else if (opt_url) { /* Handling URL (-U opt) */
- url = opt_url;
- print_str_url = url;
- } else if (opt_data_url && opt_ctrl_url) {
- /*
- * With both control and data, we'll be setting the consumer URL after
- * session creation thus use no URL.
- */
- url = NULL;
- } else if (!opt_no_output) {
- char *tmp_path;
-
- /* Auto output path */
- tmp_path = utils_get_home_dir();
- if (tmp_path == NULL) {
- ERR("HOME path not found.\n \
- Please specify an output path using -o, --output PATH");
- ret = CMD_FATAL;
- goto error;
- }
- alloc_path = strdup(tmp_path);
- if (!alloc_path) {
- PERROR("allocating alloc_path");
- ret = CMD_FATAL;
- goto error;
- }
- ret = asprintf(&alloc_url,
- "file://%s/" DEFAULT_TRACE_DIR_NAME "/%s",
- alloc_path, session_name_date);
- if (ret < 0) {
- PERROR("asprintf trace dir name");
- ret = CMD_FATAL;
- goto error;
- }
-
- url = alloc_url;
- print_str_url = alloc_url + strlen("file://");
- } else {
- /* No output means --no-output or --snapshot mode. */
- url = NULL;