From: RĂ©mi Denis-Courmont Date: Mon, 12 Apr 2010 18:25:59 +0000 (+0300) Subject: Block setlocale() X-Git-Tag: 1.1.0-pre1~12 X-Git-Url: https://git.sesse.net/?p=vlc;a=commitdiff_plain;h=f0d55dabe9747009d296e251bda7dc2f812bb077 Block setlocale() This has already caused some problems (e.g. live555) --- diff --git a/bin/override.c b/bin/override.c index 964bc21d87..60bee0ce3e 100644 --- a/bin/override.c +++ b/bin/override.c @@ -196,6 +196,24 @@ int sigaction (int signum, const struct sigaction *act, struct sigaction *old) } +/*** Locales *** + * setlocale() is not thread-safe and has a tendency to crash other threads as + * quite many libc and libintl calls depend on the locale. + * Use uselocale() instead for thread-safety. + */ +#include + +char *setlocale (int cat, const char *locale) +{ + if (override && locale != NULL) + { + LOG("Blocked", "%d, \"%s\"", cat, locale); + return NULL; + } + return CALL(setlocale, cat, locale); +} + + /*** Xlib ****/ #ifdef HAVE_X11_XLIB_H # include