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
14 #include <common/common.hpp>
15 #include <common/defaults.hpp>
16 #include <common/utils.hpp>
17 #include <common/path.hpp>
19 #include "lttng-relayd.hpp"
22 static char *create_output_path_auto(const char *path_name
)
25 char *traces_path
= NULL
;
26 const char *default_path
;
28 default_path
= utils_get_home_dir();
29 if (default_path
== NULL
) {
30 ERR("Home path not found.\n \
31 Please specify an output path using -o, --output PATH");
34 ret
= asprintf(&traces_path
, "%s/" DEFAULT_TRACE_DIR_NAME
35 "/%s", default_path
, path_name
);
37 PERROR("asprintf trace dir name");
44 static char *create_output_path_noauto(const char *path_name
)
47 char *traces_path
= NULL
;
50 full_path
= utils_expand_path(opt_output_path
);
55 ret
= asprintf(&traces_path
, "%s/%s", full_path
, path_name
);
57 PERROR("asprintf trace dir name");
66 * Create the output trace directory path name string.
68 * Return the allocated string containing the path name or else NULL.
70 char *create_output_path(const char *path_name
)
72 LTTNG_ASSERT(path_name
);
74 if (opt_output_path
== NULL
) {
75 return create_output_path_auto(path_name
);
77 return create_output_path_noauto(path_name
);
This page took 0.030525 seconds and 4 git commands to generate.