about summary refs log tree commit diff
path: root/locale
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2009-11-17 09:37:31 -0800
committerPetr Baudis <pasky@ucw.cz>2009-11-18 10:09:35 +0100
commitb39591e9c1c156a080563d60450d5fdb7971457c (patch)
treeb1ff7bf8f1cc8f28f5a46d6d2a862862cc5aa390 /locale
parentc086031db01cc10bafe55864b1185c111a30198e (diff)
downloadglibc-b39591e9c1c156a080563d60450d5fdb7971457c.tar.gz
glibc-b39591e9c1c156a080563d60450d5fdb7971457c.tar.xz
glibc-b39591e9c1c156a080563d60450d5fdb7971457c.zip
Handle LC_GLOBAL_LOCALE in duplocale.
(cherry picked from commit 7443244740724babd575943ee33c45da326afbe7)
Diffstat (limited to 'locale')
-rw-r--r--locale/Makefile2
-rw-r--r--locale/duplocale.c6
2 files changed, 6 insertions, 2 deletions
diff --git a/locale/Makefile b/locale/Makefile
index 2d645daa2f..2dbd8dc6a5 100644
--- a/locale/Makefile
+++ b/locale/Makefile
@@ -38,7 +38,7 @@ distribute	= localeinfo.h categories.def iso-639.def iso-3166.def \
 routines	= setlocale findlocale loadlocale loadarchive \
 		  localeconv nl_langinfo nl_langinfo_l mb_cur_max \
 		  newlocale duplocale freelocale uselocale
-tests		= tst-C-locale tst-locname
+tests		= tst-C-locale tst-locname tst-duplocale
 categories	= ctype messages monetary numeric time paper name \
 		  address telephone measurement identification collate
 aux		= $(categories:%=lc-%) $(categories:%=C-%) SYS_libc C_name \
diff --git a/locale/duplocale.c b/locale/duplocale.c
index 61782590d7..63513c539c 100644
--- a/locale/duplocale.c
+++ b/locale/duplocale.c
@@ -1,5 +1,5 @@
 /* Duplicate handle for selection of locales.
-   Copyright (C) 1997,2000,2001,2002,2005,2008 Free Software Foundation, Inc.
+   Copyright (C) 1997,2000-2002,2005,2008,2009 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
 
@@ -37,6 +37,10 @@ __duplocale (__locale_t dataset)
   if (dataset == _nl_C_locobj_ptr)
     return dataset;
 
+  /* Handle a special value.  */
+  if (dataset == LC_GLOBAL_LOCALE)
+    dataset = &_nl_global_locale;
+
   __locale_t result;
   int cnt;
   size_t names_len = 0;