X-Git-Url: https://git.lttng.org/?p=lttng-tools.git;a=blobdiff_plain;f=src%2Flib%2Flttng-ctl%2Flttng-ctl-health.c;h=3de74fd11009bee33df7710f2a6d25fdeda1d05f;hp=d6a3e4f135bee8696fbada9be6840e34f1df8109;hb=336a72eb946ce9427c0ae28fdc25a51ae829f728;hpb=ae0a823f9f7e1d3800479488a58efc2f92f27d89 diff --git a/src/lib/lttng-ctl/lttng-ctl-health.c b/src/lib/lttng-ctl/lttng-ctl-health.c index d6a3e4f13..3de74fd11 100644 --- a/src/lib/lttng-ctl/lttng-ctl-health.c +++ b/src/lib/lttng-ctl/lttng-ctl-health.c @@ -15,7 +15,6 @@ #include #include #include -#include #include #include @@ -24,6 +23,7 @@ #include #include #include +#include #include "lttng-ctl-helper.h" @@ -62,6 +62,7 @@ const char *sessiond_thread_name[NR_HEALTH_SESSIOND_TYPES] = { [ HEALTH_SESSIOND_TYPE_APP_REG_DISPATCH ] = "Session daemon application registration dispatcher", [ HEALTH_SESSIOND_TYPE_ROTATION ] = "Session daemon rotation manager", [ HEALTH_SESSIOND_TYPE_TIMER ] = "Session daemon timer manager", + [ HEALTH_SESSIOND_TYPE_ACTION_EXECUTOR ] = "Session daemon trigger action executor", }; static @@ -93,7 +94,7 @@ const char **thread_name[NR_HEALTH_COMPONENT] = { /* * Set health socket path. * - * Returns 0 on success or -ENOMEM. + * Returns 0 on success or a negative errno. */ static int set_health_socket_path(struct lttng_health *lh, @@ -142,10 +143,10 @@ int set_health_socket_path(struct lttng_health *lh, uid = getuid(); if (uid == 0 || tracing_group) { - lttng_ctl_copy_string(lh->health_sock_path, + ret = lttng_strncpy(lh->health_sock_path, global_str, sizeof(lh->health_sock_path)); - return 0; + return ret == 0 ? 0 : -EINVAL; } /* @@ -217,20 +218,30 @@ struct lttng_health * struct lttng_health *lttng_health_create_relayd(const char *path) { - struct lttng_health *lh; + int ret; + struct lttng_health *lh = NULL; if (!path) { - return NULL; + goto error; } lh = lttng_health_create(HEALTH_COMPONENT_RELAYD, NR_HEALTH_RELAYD_TYPES); if (!lh) { - return NULL; + goto error; } - lttng_ctl_copy_string(lh->health_sock_path, path, - sizeof(lh->health_sock_path)); + + ret = lttng_strncpy(lh->health_sock_path, path, + sizeof(lh->health_sock_path)); + if (ret) { + goto error; + } + return lh; + +error: + free(lh); + return NULL; } void lttng_health_destroy(struct lttng_health *lh)