2 * Copyright (C) 2013 Julien Desfossez <jdesfossez@efficios.com>
3 * Copyright (C) 2013 David Goulet <dgoulet@efficios.com>
5 * SPDX-License-Identifier: GPL-2.0-only
15 #include <common/common.h>
16 #include <common/defaults.h>
17 #include <common/utils.h>
18 #include <common/path.h>
20 #include "lttng-relayd.h"
23 static char *create_output_path_auto(const char *path_name
)
26 char *traces_path
= NULL
;
27 const char *default_path
;
29 default_path
= utils_get_home_dir();
30 if (default_path
== NULL
) {
31 ERR("Home path not found.\n \
32 Please specify an output path using -o, --output PATH");
35 ret
= asprintf(&traces_path
, "%s/" DEFAULT_TRACE_DIR_NAME
36 "/%s", default_path
, path_name
);
38 PERROR("asprintf trace dir name");
45 static char *create_output_path_noauto(const char *path_name
)
48 char *traces_path
= NULL
;
51 full_path
= utils_expand_path(opt_output_path
);
56 ret
= asprintf(&traces_path
, "%s/%s", full_path
, path_name
);
58 PERROR("asprintf trace dir name");
67 * Create the output trace directory path name string.
69 * Return the allocated string containing the path name or else NULL.
71 char *create_output_path(const char *path_name
)
75 if (opt_output_path
== NULL
) {
76 return create_output_path_auto(path_name
);
78 return create_output_path_noauto(path_name
);
This page took 0.030806 seconds and 4 git commands to generate.