aboutsummaryrefslogtreecommitdiffstats
path: root/src/libutil
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2015-09-24 15:30:04 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2015-09-24 15:30:04 +0100
commit503f5ae9f8df69485378c55bd952b2ebe593220e (patch)
tree05bccb8775f6e04a1b8f92a249027b082597c5bb /src/libutil
parent8d9bd52f88cfbe82d7f5e10d0b86b9c2830a939b (diff)
downloadrspamd-503f5ae9f8df69485378c55bd952b2ebe593220e.tar.gz
rspamd-503f5ae9f8df69485378c55bd952b2ebe593220e.zip
Correctly set locale before start.
Diffstat (limited to 'src/libutil')
-rw-r--r--src/libutil/util.c20
1 files changed, 14 insertions, 6 deletions
diff --git a/src/libutil/util.c b/src/libutil/util.c
index 496bd0298..11e3248ac 100644
--- a/src/libutil/util.c
+++ b/src/libutil/util.c
@@ -46,6 +46,9 @@
#ifdef HAVE_READPASSPHRASE_H
#include <readpassphrase.h>
#endif
+#ifdef HAVE_LOCALE_H
+#include <locale.h>
+#endif
#ifdef __APPLE__
#include <mach/mach_time.h>
@@ -1920,12 +1923,17 @@ rspamd_init_libs (void)
ottery_init (NULL);
rspamd_cryptobox_init ();
-#ifdef HAVE_SETLOCALE
- /* Set locale setting to C locale to avoid problems in future */
- setlocale (LC_ALL, "C");
- setlocale (LC_CTYPE, "C");
- setlocale (LC_MESSAGES, "C");
- setlocale (LC_TIME, "C");
+#ifdef HAVE_LOCALE_H
+ if (getenv ("LANG") == NULL) {
+ setlocale (LC_ALL, "C");
+ setlocale (LC_CTYPE, "C");
+ setlocale (LC_MESSAGES, "C");
+ setlocale (LC_TIME, "C");
+ }
+ else {
+ /* Just set the default locale */
+ setlocale (LC_ALL, "");
+ }
#endif
#ifdef HAVE_OPENSSL