X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=src%2Fbin%2Flttng-relayd%2Futils.c;h=db124bc354515c22f5eef55e89a1527e6b55c9ce;hb=1c9bd75bb3b9042c5ba1221c344af8b80b9dcaaf;hp=392fab6a1b68bf6e25061bb6ec869e6738e67c8a;hpb=feb0f3e5900ff58202ea0c3f227de3c1b8291952;p=lttng-tools.git diff --git a/src/bin/lttng-relayd/utils.c b/src/bin/lttng-relayd/utils.c index 392fab6a1..db124bc35 100644 --- a/src/bin/lttng-relayd/utils.c +++ b/src/bin/lttng-relayd/utils.c @@ -16,7 +16,7 @@ * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -#define _GNU_SOURCE +#define _LGPL_SOURCE #include #include #include @@ -29,12 +29,11 @@ #include "lttng-relayd.h" #include "utils.h" -static char *create_output_path_auto(char *path_name) +static char *create_output_path_auto(const char *path_name) { int ret; char *traces_path = NULL; - char *alloc_path = NULL; - char *default_path; + const char *default_path; default_path = utils_get_home_dir(); if (default_path == NULL) { @@ -42,23 +41,17 @@ static char *create_output_path_auto(char *path_name) Please specify an output path using -o, --output PATH"); goto exit; } - alloc_path = strdup(default_path); - if (alloc_path == NULL) { - PERROR("Path allocation"); - goto exit; - } ret = asprintf(&traces_path, "%s/" DEFAULT_TRACE_DIR_NAME - "/%s", alloc_path, path_name); + "/%s", default_path, path_name); if (ret < 0) { PERROR("asprintf trace dir name"); goto exit; } exit: - free(alloc_path); return traces_path; } -static char *create_output_path_noauto(char *path_name) +static char *create_output_path_noauto(const char *path_name) { int ret; char *traces_path = NULL; @@ -84,7 +77,7 @@ exit: * * Return the allocated string containing the path name or else NULL. */ -char *create_output_path(char *path_name) +char *create_output_path(const char *path_name) { assert(path_name);