#ifdef HAVE_EXECINFO_H
# include <execinfo.h>
#endif
+#ifdef NDEBUG
+# undef HAVE_BACKTRACE
+#endif
static bool override = false;
va_list ap)
{
#ifdef HAVE_BACKTRACE
- const size_t framec = 8;
+ const size_t framec = 4;
void *framev[framec];
backtrace (framev, framec);
void *sym = dlsym (RTLD_NEXT, name);
if (sym == NULL)
{
- fprintf (stderr, "Cannot resolve symbol %s!\n", name);
+ fprintf (stderr, "Cannot resolve symbol %s: %s\n", name,
+ dlerror ());
abort ();
}
return sym;
}
+/*** 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 <locale.h>
+
+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 <X11/Xlib.h>
}
#endif
#else
-static void vlc_enable_override (void)
+void vlc_enable_override (void)
{
}
#endif