From: Theodore Ts'o Date: Sun, 10 Feb 2008 04:39:27 +0000 (-0500) Subject: libcom_err: Use thread local storage to fix reentrancy problems X-Git-Tag: v1.40.6~1 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=47526e3568f93a13caa347408496f1f1d48af74c;p=thirdparty%2Fe2fsprogs.git libcom_err: Use thread local storage to fix reentrancy problems Address the theoretical problem of two threads trying to format a different unknown error code by using TLS. Signed-off-by: "Theodore Ts'o" --- diff --git a/lib/et/error_message.c b/lib/et/error_message.c index 708dd2fc5..2507fc032 100644 --- a/lib/et/error_message.c +++ b/lib/et/error_message.c @@ -38,7 +38,13 @@ #include "error_table.h" #include "internal.h" -static char buffer[25]; +#ifdef TLS +#define THREAD_LOCAL static TLS +#else +#define THREAD_LOCAL static +#endif + +THREAD_LOCAL char buffer[25]; struct et_list * _et_list = (struct et_list *) NULL; struct et_list * _et_dynamic_list = (struct et_list *) NULL;