From 11eeb23eff5b7f2c6a196b92a416f7597f5c63ec Mon Sep 17 00:00:00 2001 From: Mathieu Desnoyers Date: Tue, 10 May 2016 20:37:36 -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 --- .../org/lttng/ust/agent/LTTngTCPSessiondClient.java | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/liblttng-ust-java-agent/java/org/lttng/ust/agent/LTTngTCPSessiondClient.java b/liblttng-ust-java-agent/java/org/lttng/ust/agent/LTTngTCPSessiondClient.java index d376f672..e2494923 100644 --- a/liblttng-ust-java-agent/java/org/lttng/ust/agent/LTTngTCPSessiondClient.java +++ b/liblttng-ust-java-agent/java/org/lttng/ust/agent/LTTngTCPSessiondClient.java @@ -245,7 +245,16 @@ 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