From e699eda9762d3cf3b0c40329eb3b6ce0947789dc Mon Sep 17 00:00:00 2001 From: Mathieu Desnoyers Date: Mon, 29 Oct 2012 21:39:42 -0400 Subject: [PATCH] Cleanup: don't spawn per-user thread if HOME is not set Reported-by: David OShea Signed-off-by: Mathieu Desnoyers --- liblttng-ust/lttng-ust-comm.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/liblttng-ust/lttng-ust-comm.c b/liblttng-ust/lttng-ust-comm.c index 16a63406..dece0ee6 100644 --- a/liblttng-ust/lttng-ust-comm.c +++ b/liblttng-ust/lttng-ust-comm.c @@ -156,14 +156,16 @@ int setup_local_apps(void) * Disallow per-user tracing for setuid binaries. */ if (uid != geteuid()) { - local_apps.allowed = 0; + assert(local_apps.allowed == 0); return 0; - } else { - local_apps.allowed = 1; } home_dir = (const char *) getenv("HOME"); - if (!home_dir) + if (!home_dir) { + WARN("HOME environment variable not set. Disabling LTTng-UST per-user tracing."); + assert(local_apps.allowed == 0); return -ENOENT; + } + local_apps.allowed = 1; snprintf(local_apps.sock_path, PATH_MAX, DEFAULT_HOME_APPS_UNIX_SOCK, home_dir); snprintf(local_apps.wait_shm_path, PATH_MAX, @@ -891,7 +893,7 @@ void __attribute__((constructor)) lttng_ust_init(void) ret = setup_local_apps(); if (ret) { - ERR("Error setting up to local apps"); + DBG("local apps setup returned %d", ret); } /* A new thread created by pthread_create inherits the signal mask -- 2.34.1