From 74c322cbc35889057af2e06b3941bb9cbde864a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20=C5=BDidek?= Date: Mon, 19 Oct 2015 15:49:02 +0200 Subject: [PATCH 095/108] server_setup: Log failed attempt to set locale MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Failed setlocale call could cause unexpected behaviour. It is better to generate DEBUG message if this happens. Reviewed-by: Michal Židek (cherry picked from commit a0c8aae6b31867f29e83e4f8a2a7ef037a82569e) (cherry picked from commit 76ab3eb947f4d6fe6555d8ea0ae97dc3966f02ac) --- src/util/server.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/util/server.c b/src/util/server.c index 7e9b76f74ee5e76d2481eb425eff4811cc2e780e..7aa8d809663fe562a6ac25fc0f0ce7eddfcb4166 100644 --- a/src/util/server.c +++ b/src/util/server.c @@ -458,6 +458,7 @@ int server_setup(const char *name, int flags, bool dm; struct tevent_signal *tes; struct logrotate_ctx *lctx; + char *locale; ret = chown_debug_file(NULL, uid, gid); if (ret != EOK) { @@ -509,7 +510,12 @@ int server_setup(const char *name, int flags, } /* Set up locale */ - setlocale(LC_ALL, ""); + locale = setlocale(LC_ALL, ""); + if (locale == NULL) { + /* Just print debug message and continue */ + DEBUG(SSSDBG_TRACE_FUNC, "Unable to set locale\n"); + } + bindtextdomain(PACKAGE, LOCALEDIR); textdomain(PACKAGE); -- 2.7.3