X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=src%2Fbin%2Flttng%2Fcommands%2Fcreate.c;h=1ebe590ad279915e8e3e7ba05784e0333eb9064f;hb=ab2e5c7c226283aedef88cbc4683c8ad4a7937f2;hp=4f97c86489e9934c9f2b3b136d6757dc186ea1c6;hpb=62e55253348f999a97d323a3b1503478c4f3ff51;p=lttng-tools.git diff --git a/src/bin/lttng/commands/create.c b/src/bin/lttng/commands/create.c index 4f97c8648..1ebe590ad 100644 --- a/src/bin/lttng/commands/create.c +++ b/src/bin/lttng/commands/create.c @@ -16,6 +16,7 @@ */ #define _GNU_SOURCE +#define _LGPL_SOURCE #include #include #include @@ -376,16 +377,22 @@ static int create_session(void) */ url = NULL; } else if (!opt_no_output) { + char *tmp_path; + /* Auto output path */ - alloc_path = utils_get_home_dir(); - if (alloc_path == NULL) { + 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(alloc_path); - + 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);