summaryrefslogtreecommitdiff
path: root/libstdc++-v3/src/locale.cc
diff options
context:
space:
mode:
authorPaolo Carlini <pcarlini@unitus.it>2002-09-05 23:13:07 +0200
committerPaolo Carlini <paolo@gcc.gnu.org>2002-09-05 21:13:07 +0000
commite2cbee7fd1d126a404e33321057392c5777db950 (patch)
tree04d7512b4857d0931c9bdb1ce34ae5d6b7799f97 /libstdc++-v3/src/locale.cc
parentb3fbfc0766b57cc52e1398e131161df6c7bb1ef7 (diff)
downloadgcc-e2cbee7fd1d126a404e33321057392c5777db950.tar.gz
re PR libstdc++/7811 (default locale not taken from environment)
2002-09-05 Paolo Carlini <pcarlini@unitus.it> Roland McGrath <roland@redhat.com> PR libstdc++/7811 * src/locale.cc (locale::locale(__s)): Use getenv instead of setenv for the environment locale. * testsuite/22_locale/ctor_copy_dtor.cc (test03): New. Co-Authored-By: Roland McGrath <roland@redhat.com> From-SVN: r56865
Diffstat (limited to 'libstdc++-v3/src/locale.cc')
-rw-r--r--libstdc++-v3/src/locale.cc10
1 files changed, 9 insertions, 1 deletions
diff --git a/libstdc++-v3/src/locale.cc b/libstdc++-v3/src/locale.cc
index 3cb9d1b4cbf..99c8c67144b 100644
--- a/libstdc++-v3/src/locale.cc
+++ b/libstdc++-v3/src/locale.cc
@@ -202,7 +202,15 @@ namespace std
if (strcmp(__s, "C") == 0 || strcmp(__s, "POSIX") == 0)
(_M_impl = _S_classic)->_M_add_reference();
else if (strcmp(__s, "") == 0)
- _M_impl = new _Impl(setlocale(LC_ALL, NULL), 1);
+ {
+ char* __env = getenv("LC_ALL");
+ if (__env)
+ _M_impl = new _Impl(__env, 1);
+ else if ((__env = getenv("LANG")))
+ _M_impl = new _Impl(__env, 1);
+ else
+ (_M_impl = _S_classic)->_M_add_reference();
+ }
else
_M_impl = new _Impl(__s, 1);
}