X-Git-Url: https://git.lttng.org/?p=lttng-tools.git;a=blobdiff_plain;f=src%2Fbin%2Flttng-relayd%2Fhealth-relayd.c;h=d34a376c53989dd314cf217c0da52e7d69f1a3e4;hp=5c4fb50a15154794b76aec6284b3940479baf7ab;hb=32d1569c14b4e1efce9099a1e04c338a9c42f1f7;hpb=6c1c0768320135c6936c371b09731851b508c023 diff --git a/src/bin/lttng-relayd/health-relayd.c b/src/bin/lttng-relayd/health-relayd.c index 5c4fb50a1..d34a376c5 100644 --- a/src/bin/lttng-relayd/health-relayd.c +++ b/src/bin/lttng-relayd/health-relayd.c @@ -49,6 +49,7 @@ #include #include #include +#include #include "lttng-relayd.h" #include "health-relayd.h" @@ -136,7 +137,7 @@ int parse_health_env(void) { const char *health_path; - health_path = getenv(LTTNG_RELAYD_HEALTH_ENV); + health_path = lttng_secure_getenv(LTTNG_RELAYD_HEALTH_ENV); if (health_path) { strncpy(health_unix_sock_path, health_path, PATH_MAX); @@ -150,7 +151,7 @@ static int setup_health_path(void) { int is_root, ret = 0; - char *home_path = NULL, *rundir = NULL, *relayd_path; + char *home_path = NULL, *rundir = NULL, *relayd_path = NULL; ret = parse_health_env(); if (ret) { @@ -161,6 +162,10 @@ int setup_health_path(void) if (is_root) { rundir = strdup(DEFAULT_LTTNG_RUNDIR); + if (!rundir) { + ret = -ENOMEM; + goto end; + } } else { /* * Create rundir from home path. This will create something like @@ -218,6 +223,7 @@ int setup_health_path(void) end: free(rundir); + free(relayd_path); return ret; } @@ -326,6 +332,11 @@ restart: revents = LTTNG_POLL_GETEV(&events, i); pollfd = LTTNG_POLL_GETFD(&events, i); + if (!revents) { + /* No activity for this FD (poll implementation). */ + continue; + } + /* Thread quit pipe has been closed. Killing thread. */ ret = check_health_quit_pipe(pollfd, revents); if (ret) {