about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorTimo Teräs <timo.teras@iki.fi>2015-06-05 10:39:42 +0300
committerRich Felker <dalias@aerifal.cx>2015-06-05 15:21:40 +0000
commit63f4b9f18f3674124d8bcb119739fec85e6da005 (patch)
tree3dc38e3b004052aed437a311728bf66ee4da628e /src
parente6f09004af4d3ffc4e4ad5b5d33cf45891c25f25 (diff)
downloadmusl-63f4b9f18f3674124d8bcb119739fec85e6da005.tar.gz
musl-63f4b9f18f3674124d8bcb119739fec85e6da005.tar.xz
musl-63f4b9f18f3674124d8bcb119739fec85e6da005.zip
fix uselocale((locale_t)0) not to modify locale
commit 68630b55c0c7219fe9df70dc28ffbf9efc8021d8 made the new locale to
be assigned unconditonally resulting in crashes later on.
Diffstat (limited to 'src')
-rw-r--r--src/locale/uselocale.c4
1 files changed, 1 insertions, 3 deletions
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;
 }