From: Khem Raj Date: Fri, 6 Sep 2019 04:39:05 +0000 (-0700) Subject: util_sec.c: Move __thread variable to global scope X-Git-Tag: talloc-2.3.1~832 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5a80f399b51221fb0b8661f30d940ca24e1ce627;p=thirdparty%2Fsamba.git util_sec.c: Move __thread variable to global scope Make clang happy otherwise it complains about variable scope fixes source3/./lib/util_sec.c:470:4: error: '__thread' variables must have global storage } __thread cache; ^ Signed-off-by: Khem Raj Reviewed-by: Matthias Dieter Wallnöfer Reviewed-by: Andreas Schneider --- diff --git a/source3/lib/util_sec.c b/source3/lib/util_sec.c index 974e458b06e..b6fb6c0a4a1 100644 --- a/source3/lib/util_sec.c +++ b/source3/lib/util_sec.c @@ -444,6 +444,17 @@ void become_user_permanently(uid_t uid, gid_t gid) assert_gid(gid, gid); } +#ifdef HAVE___THREAD + struct cache_t { + bool active; + uid_t uid; + gid_t gid; + size_t setlen; + uintptr_t gidset; + }; + +static __thread struct cache_t cache; +#endif /********************************************************** Function to set thread specific credentials. Leave saved-set uid/gid alone.Must be thread-safe code. @@ -461,14 +472,6 @@ int set_thread_credentials(uid_t uid, * available. */ #ifdef HAVE___THREAD - static struct { - bool active; - uid_t uid; - gid_t gid; - size_t setlen; - uintptr_t gidset; - } __thread cache; - if (cache.active && cache.uid == uid && cache.gid == gid &&