2 * Copyright (C) 2013 - Julien Desfossez <jdesfossez@efficios.com>
3 * David Goulet <dgoulet@efficios.com>
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License, version 2 only, as
7 * published by the Free Software Foundation.
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
14 * You should have received a copy of the GNU General Public License along with
15 * this program; if not, write to the Free Software Foundation, Inc., 51
16 * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
25 #include <common/common.h>
26 #include <common/defaults.h>
27 #include <common/utils.h>
29 #include "lttng-relayd.h"
32 static char *create_output_path_auto(const char *path_name
)
35 char *traces_path
= NULL
;
36 char *alloc_path
= NULL
;
39 default_path
= utils_get_home_dir();
40 if (default_path
== NULL
) {
41 ERR("Home path not found.\n \
42 Please specify an output path using -o, --output PATH");
45 alloc_path
= strdup(default_path
);
46 if (alloc_path
== NULL
) {
47 PERROR("Path allocation");
50 ret
= asprintf(&traces_path
, "%s/" DEFAULT_TRACE_DIR_NAME
51 "/%s", alloc_path
, path_name
);
53 PERROR("asprintf trace dir name");
61 static char *create_output_path_noauto(const char *path_name
)
64 char *traces_path
= NULL
;
67 full_path
= utils_expand_path(opt_output_path
);
72 ret
= asprintf(&traces_path
, "%s/%s", full_path
, path_name
);
74 PERROR("asprintf trace dir name");
83 * Create the output trace directory path name string.
85 * Return the allocated string containing the path name or else NULL.
87 char *create_output_path(const char *path_name
)
91 if (opt_output_path
== NULL
) {
92 return create_output_path_auto(path_name
);
94 return create_output_path_noauto(path_name
);
This page took 0.031309 seconds and 4 git commands to generate.