Fix: getenv can return null
authorJonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Tue, 30 Apr 2019 23:09:24 +0000 (19:09 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Wed, 1 May 2019 14:36:58 +0000 (10:36 -0400)
On system with LANG not defined getenv will return null.

An example of such system is the lava runner used by ci.lttng.org.

https://ci.lttng.org/view/System%20Tests/

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
src/common/time.c

index 5519e3ab4715240cfd1b27ef7701d36c1b737039..a01c16df5c44f024c00469beeaa014542c658c9f 100644 (file)
@@ -76,7 +76,7 @@ void __attribute__((constructor)) init_locale_utf8_support(void)
 
        if (program_locale && strstr(program_locale, "utf8")) {
                utf8_output_supported = true;
-       } else if (strstr(lang, "utf8")) {
+       } else if (lang && strstr(lang, "utf8")) {
                utf8_output_supported = true;
        }
 }
This page took 0.025138 seconds and 4 git commands to generate.