Cleanup: fix typo
[lttng-ust.git] / liblttng-ust / lttng-ust-comm.c
index 60beef8f43d5625fbc6554acdedf226de67b2b9c..3db256510f5b2161791d636ecb84dec63dda397e 100644 (file)
@@ -188,6 +188,22 @@ extern void lttng_ring_buffer_client_discard_exit(void);
 extern void lttng_ring_buffer_client_discard_rt_exit(void);
 extern void lttng_ring_buffer_metadata_client_exit(void);
 
+/*
+ * Returns the HOME directory path. Caller MUST NOT free(3) the returned
+ * pointer.
+ */
+static
+const char *get_lttng_home_dir(void)
+{
+       const char *val;
+
+       val = (const char *) getenv("LTTNG_HOME");
+       if (val != NULL) {
+               return val;
+       }
+       return (const char *) getenv("HOME");
+}
+
 /*
  * Force a read (imply TLS fixup for dlopen) of TLS variables.
  */
@@ -232,7 +248,7 @@ int setup_local_apps(void)
                assert(local_apps.allowed == 0);
                return 0;
        }
-       home_dir = (const char *) getenv("HOME");
+       home_dir = get_lttng_home_dir();
        if (!home_dir) {
                WARN("HOME environment variable not set. Disabling LTTng-UST per-user tracing.");
                assert(local_apps.allowed == 0);
@@ -982,7 +998,7 @@ restart:
                        WARN("Error setting socket send timeout");
                }
        } else if (timeout < -1) {
-               WARN("Unsuppoorted timeout value %ld", timeout);
+               WARN("Unsupported timeout value %ld", timeout);
        }
 
        ust_lock();
This page took 0.024283 seconds and 4 git commands to generate.