This reverts commit
318e4c832cc9a4209dcea885ef2a66cfd16f99d2.
The create_session function was changed making the session name not
having the date and time append to it anymore. This completely broke the
default behavior of automatic session creation. Only one possible
session name was 'auto'.
Signed-off-by: David Goulet <dgoulet@efficios.com>
*/
static int create_session()
{
*/
static int create_session()
{
+ int ret, have_name = 0;
char datetime[16];
char *session_name, *traces_path = NULL, *alloc_path = NULL;
time_t rawtime;
char datetime[16];
char *session_name, *traces_path = NULL, *alloc_path = NULL;
time_t rawtime;
/* Auto session name creation */
if (opt_session_name == NULL) {
/* Auto session name creation */
if (opt_session_name == NULL) {
- ret = asprintf(&session_name, "auto");
+ ret = asprintf(&session_name, "auto-%s", datetime);
if (ret < 0) {
perror("asprintf session name");
if (ret < 0) {
perror("asprintf session name");
goto error;
}
DBG("Auto session name set to %s", session_name);
} else {
session_name = opt_session_name;
goto error;
}
DBG("Auto session name set to %s", session_name);
} else {
session_name = opt_session_name;
}
/* Auto output path */
if (opt_output_path == NULL) {
alloc_path = strdup(config_get_default_path());
if (alloc_path == NULL) {
}
/* Auto output path */
if (opt_output_path == NULL) {
alloc_path = strdup(config_get_default_path());
if (alloc_path == NULL) {
- ERR("Home path not found.\n"
- "Please specify an output path using -o, --output PATH\n");
+ ERR("Home path not found.\n \
+ Please specify an output path using -o, --output PATH");
ret = CMD_FATAL;
goto error;
}
ret = CMD_FATAL;
goto error;
}
- ret = asprintf(&traces_path, "%s/" DEFAULT_TRACE_DIR_NAME "/%s-%s",
- alloc_path, session_name, datetime);
+ if (have_name) {
+ ret = asprintf(&traces_path, "%s/" DEFAULT_TRACE_DIR_NAME
+ "/%s-%s", alloc_path, session_name, datetime);
+ } else {
+ ret = asprintf(&traces_path, "%s/" DEFAULT_TRACE_DIR_NAME
+ "/%s", alloc_path, session_name);
+ }
+
if (ret < 0) {
perror("asprintf trace dir name");
if (ret < 0) {
perror("asprintf trace dir name");