From f0d55dabe9747009d296e251bda7dc2f812bb077 Mon Sep 17 00:00:00 2001 From: =?utf8?q?R=C3=A9mi=20Denis-Courmont?= Date: Mon, 12 Apr 2010 21:25:59 +0300 Subject: [PATCH] Block setlocale() This has already caused some problems (e.g. live555) --- bin/override.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) 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 -- 2.39.2