--- /usr/src/lib/libc/nls/msgcat.c 2016-07-22 16:46:48.449655000 +0300 +++ ./msgcat.c 2016-08-23 20:43:02.603807000 +0300 @@ -47,16 +47,17 @@ #include #include #include -#include #include #include #include #include #include #include +#include #include "un-namespace.h" #include "../locale/setlocale.h" /* for ENCODING_LEN */ +#include "../locale/xlocale_private.h" #define _DEFAULT_NLS_PATH "/usr/share/nls/%L/%N.cat:/usr/share/nls/%N/%L:/usr/local/share/nls/%L/%N.cat:/usr/local/share/nls/%N/%L" @@ -118,6 +119,7 @@ char *base, *cptr, *cptr1, *lang, *nlspath, *pathP, *pcode; char *plang, *pter, *tmpptr; int saverr, spcleft; + locale_t loc; char path[PATH_MAX]; /* sanity checking */ @@ -128,9 +130,11 @@ /* have a pathname */ lang = NULL; else { - if (type == NL_CAT_LOCALE) - lang = setlocale(LC_MESSAGES, NULL); - else + if (type == NL_CAT_LOCALE) { + loc = __get_locale(); + FIX_LOCALE(loc); + lang = querylocale(LC_MESSAGES_MASK, loc); + } else lang = getenv("LANG"); if (lang == NULL || *lang == '\0' || strlen(lang) > ENCODING_LEN ||