summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
a620c89)
utils_get_home_dir() returns a string obtained from getenv() that
should not be modified nor free'd. However, utils_get_user_home_dir()
returns the path as a copy.
The return parameter of utils_get_home_dir() is marked as const
to underline this difference and prevent mix-ups in the use of
those functions.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
int setup_health_path(void)
{
int is_root, ret = 0;
int setup_health_path(void)
{
int is_root, ret = 0;
- char *home_path = NULL, *rundir = NULL, *relayd_path = NULL;
+ const char *home_path = NULL;
+ char *rundir = NULL, *relayd_path = NULL;
ret = parse_health_env();
if (ret) {
ret = parse_health_env();
if (ret) {
struct lttng_trace_chunk *chunk = NULL;
enum lttng_trace_chunk_status status;
struct lttng_directory_handle output_directory;
struct lttng_trace_chunk *chunk = NULL;
enum lttng_trace_chunk_status status;
struct lttng_directory_handle output_directory;
- char *base_path = opt_output_path;
+ const char *base_path = opt_output_path;
if (base_path == NULL) {
/* No output path defined */
if (base_path == NULL) {
/* No output path defined */
{
int ret;
char *traces_path = NULL;
{
int ret;
char *traces_path = NULL;
+ const char *default_path;
default_path = utils_get_home_dir();
if (default_path == NULL) {
default_path = utils_get_home_dir();
if (default_path == NULL) {
- char *home_path = utils_get_home_dir();
+ const char *home_path = utils_get_home_dir();
if (!home_path) {
ERR("Can't get HOME directory for socket creation");
if (!home_path) {
ERR("Can't get HOME directory for socket creation");
* On success, returns 0;
* on error, returns -1.
*/
* On success, returns 0;
* on error, returns -1.
*/
-static int create_config_file(char *path)
+static int create_config_file(const char *path)
*/
void config_destroy_default(void)
{
*/
void config_destroy_default(void)
{
- char *path = utils_get_home_dir();
+ const char *path = utils_get_home_dir();
if (path == NULL) {
return;
}
if (path == NULL) {
return;
}
int config_init(const char *session_name)
{
int ret;
int config_init(const char *session_name)
{
int ret;
path = utils_get_home_dir();
if (path == NULL) {
path = utils_get_home_dir();
if (path == NULL) {
static
char *_get_session_name(int quiet)
{
static
char *_get_session_name(int quiet)
{
- char *path, *session_name = NULL;
+ const char *path;
+ char *session_name = NULL;
/* Get path to config file */
path = utils_get_home_dir();
/* Get path to config file */
path = utils_get_home_dir();
config_entry_handler_cb handler, void *user_data)
{
int ret = 0;
config_entry_handler_cb handler, void *user_data)
{
int ret = 0;
FILE *config_file = NULL;
struct handler_filter_args filter = { section, handler, user_data };
FILE *config_file = NULL;
struct handler_filter_args filter = { section, handler, user_data };
const char *sys_path;
/* Try home path */
const char *sys_path;
/* Try home path */
* Otherwise returns the value of HOME.
*/
LTTNG_HIDDEN
* Otherwise returns the value of HOME.
*/
LTTNG_HIDDEN
-char *utils_get_home_dir(void)
+const char *utils_get_home_dir(void)
{
char *val = NULL;
struct passwd *pwd;
{
char *val = NULL;
struct passwd *pwd;
int utils_parse_time_suffix(char const * const str, uint64_t * const time_us);
int utils_get_count_order_u32(uint32_t x);
int utils_get_count_order_u64(uint64_t x);
int utils_parse_time_suffix(char const * const str, uint64_t * const time_us);
int utils_get_count_order_u32(uint32_t x);
int utils_get_count_order_u64(uint64_t x);
-char *utils_get_home_dir(void);
+const char *utils_get_home_dir(void);
char *utils_get_user_home_dir(uid_t uid);
size_t utils_get_current_time_str(const char *format, char *dst, size_t len);
int utils_get_group_id(const char *name, bool warn, gid_t *gid);
char *utils_get_user_home_dir(uid_t uid);
size_t utils_get_current_time_str(const char *format, char *dst, size_t len);
int utils_get_group_id(const char *name, bool warn, gid_t *gid);