- /* Generate session name based on the session count */
- if (asprintf(&new_session->name, "%s%d", "lttng-", session_count) < 0) {
- goto error_mem;
+ ERR("No session name given");
+ ret = -1;
+ goto error;
+ }
+
+ /* Define session system path */
+ if (path != NULL) {
+ if (strstr(name, "auto-") == NULL) {
+ time(&rawtime);
+ timeinfo = localtime(&rawtime);
+ strftime(date_time, sizeof(date_time), "-%Y%m%d-%H%M%S", timeinfo);
+ } else {
+ date_time[0] = '\0';