From 43e06ff39584570817949dc5de118d2b7ca854c1 Mon Sep 17 00:00:00 2001 From: Michal Židek Date: Mon, 19 Oct 2015 15:38:08 +0200 Subject: util: Continue if setlocale fails MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit setlocale needs some environment variables to be set in order to work. These variables are not present in some special cases. We should not fail completely in these cases but continue with the compatible C locale. Resolves: https://fedorahosted.org/sssd/ticket/2785 Reviewed-by: Michal Židek --- src/sss_client/ssh/sss_ssh_client.c | 4 +++- src/tools/tools_util.c | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/sss_client/ssh/sss_ssh_client.c b/src/sss_client/ssh/sss_ssh_client.c index 0d206ef58..a198039ec 100644 --- a/src/sss_client/ssh/sss_ssh_client.c +++ b/src/sss_client/ssh/sss_ssh_client.c @@ -50,7 +50,9 @@ int set_locale(void) c = setlocale(LC_ALL, ""); if (c == NULL) { - return EIO; + /* If setlocale fails, continue with the default + * locale. */ + DEBUG(SSSDBG_MINOR_FAILURE, "Unable to set locale\n"); } errno = 0; diff --git a/src/tools/tools_util.c b/src/tools/tools_util.c index 68f6588ea..f9dca7287 100644 --- a/src/tools/tools_util.c +++ b/src/tools/tools_util.c @@ -259,7 +259,9 @@ int set_locale(void) c = setlocale(LC_ALL, ""); if (c == NULL) { - return EIO; + /* If setlocale fails, continue with the default + * locale. */ + DEBUG(SSSDBG_MINOR_FAILURE, "Unable to set locale\n"); } errno = 0; -- cgit