Karl Williamson wrote:
> > This should fix things.
> 
> Does it work if 'oldloc' is 0? a legal value

Nope. Good catch.


Index: newlocale.c
===================================================================
RCS file: /home/cvs/src/lib/libc/locale/newlocale.c,v
retrieving revision 1.1
diff -u -p -r1.1 newlocale.c
--- newlocale.c 5 Sep 2017 03:16:13 -0000       1.1
+++ newlocale.c 27 Mar 2019 22:01:12 -0000
@@ -22,8 +22,7 @@
 #include "rune.h"
 
 locale_t
-newlocale(int mask, const char *locname,
-    locale_t oldloc __attribute__((__unused__)))
+newlocale(int mask, const char *locname, locale_t oldloc)
 {
        int      ic, flag;
 
@@ -45,7 +44,7 @@ newlocale(int mask, const char *locname,
 
        /* Only character encoding has thread-specific effects. */
        if ((mask & LC_CTYPE_MASK) == 0)
-               return _LOCALE_C;
+               return oldloc ? oldloc : _LOCALE_C;
 
        /* The following may initialize UTF-8 for later use. */
        if ((locname = _get_locname(LC_CTYPE, locname)) == NULL) {

Reply via email to