X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=bin%2Foverride.c;h=b5de22d0f558b4c941937048c63ea11c75ffc0a9;hb=b67a5864cbcd069e3c0ad971745137469bb07ed6;hp=f3eebae5a069ad596a87737bc751750a7b42f9d5;hpb=c37501542c7aee37635f6cabd0301924c5f8b0dc;p=vlc diff --git a/bin/override.c b/bin/override.c index f3eebae5a0..b5de22d0f5 100644 --- a/bin/override.c +++ b/bin/override.c @@ -33,6 +33,7 @@ void vlc_enable_override (void); #include #include #include +#include #include #include #ifdef HAVE_EXECINFO_H @@ -260,6 +261,20 @@ char *setlocale (int cat, const char *locale) } +/* strerror() is not thread-safe in theory (POSIX), nor in practice (glibc). + * This caused quite nasty crashes in the history of VLC/Linux. */ +char *strerror (int val) +{ + if (override) + { + static const char msg[] = + "Error message unavailable (use strerror_r instead of strerror)!"; + LOG("Blocked", "%d", val); + return (char *)msg; + } + return CALL(strerror, val); +} + /*** Xlib ****/ #ifdef HAVE_X11_XLIB_H # include