Fix: race between lttng-ust getenv() and application setenv()
[lttng-ust.git] / snprintf / core.c
index 2fa9839c4e4103c40635cfd8181418b9bf158ccf..c017b832220b0230ed2bb9cdeb8eed51fe451286 100644 (file)
 #include <usterr-signal-safe.h>
 
 volatile enum ust_loglevel ust_loglevel;
+
+void init_usterr(void)
+{
+       char *ust_debug;
+
+       if (ust_loglevel == UST_LOGLEVEL_UNKNOWN) {
+               /*
+                * This getenv is not part of lttng_getenv() because it
+                * is required to print ERR() performed during getenv
+                * initialization.
+                */
+               ust_debug = getenv("LTTNG_UST_DEBUG");
+               if (ust_debug)
+                       ust_loglevel = UST_LOGLEVEL_DEBUG;
+               else
+                       ust_loglevel = UST_LOGLEVEL_NORMAL;
+       }
+}
This page took 0.023439 seconds and 4 git commands to generate.