From e43af5b15d14e43c3201fd0fb7bf02663e3e0127 Mon Sep 17 00:00:00 2001 From: Rinku Kothiya Date: Sat, 7 Nov 2020 12:09:36 +0530 Subject: [PATCH 482/511] logger: Always print errors in english Upstream: > Reviewed-on: https://github.com/gluster/glusterfs/pull/1657 > fixes: #1302 > Change-Id: If0e21f016155276a953c64a8dd13ff3eb281d09d > Signed-off-by: Rinku Kothiya BUG: 1896425 Change-Id: If0e21f016155276a953c64a8dd13ff3eb281d09d Signed-off-by: Rinku Kothiya Reviewed-on: https://code.engineering.redhat.com/gerrit/219999 Tested-by: RHGS Build Bot Reviewed-by: Sunil Kumar Heggodu Gopala Acharya --- libglusterfs/src/logging.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/libglusterfs/src/logging.c b/libglusterfs/src/logging.c index 7f0eff6..5874c34 100644 --- a/libglusterfs/src/logging.c +++ b/libglusterfs/src/logging.c @@ -513,6 +513,7 @@ gf_openlog(const char *ident, int option, int facility) { int _option = option; int _facility = facility; + char *language = NULL; if (-1 == _option) { _option = LOG_PID | LOG_NDELAY; @@ -522,7 +523,10 @@ gf_openlog(const char *ident, int option, int facility) } /* TODO: Should check for errors here and return appropriately */ - setlocale(LC_ALL, ""); + language = setlocale(LC_ALL, "en_US.UTF-8"); + if (!language) + setlocale(LC_ALL, ""); + setlocale(LC_NUMERIC, "C"); /* C-locale for strtod, ... */ /* close the previous syslog if open as we are changing settings */ closelog(); -- 1.8.3.1