X-Git-Url: https://git.lttng.org/?a=blobdiff_plain;f=src%2Fbin%2Flttng-relayd%2Fhealth-relayd.c;h=d34a376c53989dd314cf217c0da52e7d69f1a3e4;hb=32d1569c14b4e1efce9099a1e04c338a9c42f1f7;hp=8a5cbdfcb550f86a2010586e6eed924d19232861;hpb=53efb85a242809ed5ed21e9ab40effa696ecbc6f;p=lttng-tools.git diff --git a/src/bin/lttng-relayd/health-relayd.c b/src/bin/lttng-relayd/health-relayd.c index 8a5cbdfcb..d34a376c5 100644 --- a/src/bin/lttng-relayd/health-relayd.c +++ b/src/bin/lttng-relayd/health-relayd.c @@ -16,6 +16,7 @@ */ #define _GNU_SOURCE +#define _LGPL_SOURCE #include #include #include @@ -48,6 +49,7 @@ #include #include #include +#include #include "lttng-relayd.h" #include "health-relayd.h" @@ -135,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); @@ -149,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) { @@ -160,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 @@ -217,6 +223,7 @@ int setup_health_path(void) end: free(rundir); + free(relayd_path); return ret; } @@ -325,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) {