From: Timo Teräs Date: Fri, 5 Jun 2015 07:39:42 +0000 (+0300) Subject: fix uselocale((locale_t)0) not to modify locale X-Git-Tag: v1.1.11~59 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=63f4b9f18f3674124d8bcb119739fec85e6da005;p=oweals%2Fmusl.git fix uselocale((locale_t)0) not to modify locale commit 68630b55c0c7219fe9df70dc28ffbf9efc8021d8 made the new locale to be assigned unconditonally resulting in crashes later on. --- diff --git a/src/locale/uselocale.c b/src/locale/uselocale.c index b70a0c18..0fc5ecbc 100644 --- a/src/locale/uselocale.c +++ b/src/locale/uselocale.c @@ -8,9 +8,7 @@ locale_t __uselocale(locale_t new) locale_t old = self->locale; locale_t global = &libc.global_locale; - if (new == LC_GLOBAL_LOCALE) new = global; - - self->locale = new; + if (new) self->locale = new == LC_GLOBAL_LOCALE ? global : new; return old == global ? LC_GLOBAL_LOCALE : old; }