summaryrefslogtreecommitdiff
blob: 70868b1abc11f085bd7534596e16926f49c597ab (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
https://bugs.gentoo.org/650332

From 923b5be626a6e03fbaeee0b5cd6d0246c2f8f36f Mon Sep 17 00:00:00 2001
From: Akira TAGOH <akira@tagoh.org>
Date: Wed, 14 Mar 2018 12:35:05 +0900
Subject: [PATCH] Do not override locale if already set by app

https://bugs.freedesktop.org/show_bug.cgi?id=105492
---
 src/fccfg.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/src/fccfg.c b/src/fccfg.c
index eb0b76d..e311f17 100644
--- a/src/fccfg.c
+++ b/src/fccfg.c
@@ -45,11 +45,16 @@ retry_locale:
     is_locale_initialized = (intptr_t) fc_atomic_ptr_get (&static_is_locale_initialized);
     if (!is_locale_initialized)
     {
+	char *loc;
+
 	is_locale_initialized = FcTrue;
 	if (!fc_atomic_ptr_cmpexch (&static_is_locale_initialized, NULL,
 				    (void *)(intptr_t) is_locale_initialized))
 	    goto retry_locale;
-	setlocale (LC_ALL, "");
+
+	loc = setlocale (LC_ALL, NULL);
+	if (!loc || strcmp (loc, "C") == 0)
+	    setlocale (LC_ALL, "");
     }
 retry_config:
     config = fc_atomic_ptr_get (&_fcConfig);
-- 
2.16.2