48b6fc2dbc
A new regression in uselocale made it into this release. As suggested [1] by the musl maintainers add a patch from upstream [2] to avoid breaking programs that call uselocale. [1] http://www.musl-libc.org/download.html [2] http://git.musl-libc.org/cgit/musl/patch/?id=63f4b9f18f3674124d8bcb119739fec85e6da005 Signed-off-by: Jörg Krause <joerg.krause@embedded.rocks> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
31 lines
992 B
Diff
31 lines
992 B
Diff
From 63f4b9f18f3674124d8bcb119739fec85e6da005 Mon Sep 17 00:00:00 2001
|
|
From: Timo Teräs <timo.teras@iki.fi>
|
|
Date: Fri, 05 Jun 2015 07:39:42 +0000
|
|
Subject: fix uselocale((locale_t)0) not to modify locale
|
|
|
|
commit 68630b55c0c7219fe9df70dc28ffbf9efc8021d8 made the new locale to
|
|
be assigned unconditonally resulting in crashes later on.
|
|
|
|
Backported from: 63f4b9f18f3674124d8bcb119739fec85e6da005
|
|
|
|
Signed-off-by: Timo Teräs <timo.teras@iki.fi>
|
|
Signed-off-by: Jörg Krause <joerg.krause@embedded.rocks>
|
|
---
|
|
diff --git a/src/locale/uselocale.c b/src/locale/uselocale.c
|
|
index b70a0c1..0fc5ecb 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;
|
|
}
|
|
--
|
|
cgit v0.9.0.3-65-g4555
|