From 59e3be47eee9ed871cc60f3cee5acb3e6f327938 Mon Sep 17 00:00:00 2001 From: Mathieu Desnoyers Date: Tue, 10 May 2016 20:33:00 -0400 Subject: [PATCH] Fix: Java agent should use LTTNG_HOME Both in UST C/C++ support and Python agent, LTTNG_HOME can be used to override HOME for lttng-ust. Ensure the Java agent has the same behavior. Fixes: #881 Signed-off-by: Mathieu Desnoyers --- .../ust/agent/client/LttngTcpSessiondClient.java | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/liblttng-ust-java-agent/java/lttng-ust-agent-common/org/lttng/ust/agent/client/LttngTcpSessiondClient.java b/liblttng-ust-java-agent/java/lttng-ust-agent-common/org/lttng/ust/agent/client/LttngTcpSessiondClient.java index 6177feac..e9b52f1d 100644 --- a/liblttng-ust-java-agent/java/lttng-ust-agent-common/org/lttng/ust/agent/client/LttngTcpSessiondClient.java +++ b/liblttng-ust-java-agent/java/lttng-ust-agent-common/org/lttng/ust/agent/client/LttngTcpSessiondClient.java @@ -179,7 +179,16 @@ public class LttngTcpSessiondClient implements Runnable { } private static String getHomePath() { - return System.getProperty("user.home"); + /* + * The environment variable LTTNG_HOME overrides HOME if + * defined. + */ + String homePath = System.getenv("LTTNG_HOME"); + + if (homePath == null) { + homePath = System.getProperty("user.home"); + } + return homePath; } /** -- 2.34.1