blob: 6fc849337cc0eea0774f056e8c80e3b62f648ed9 [file] [log] [blame]
Brad Bishopc1d34332019-09-09 14:56:00 -04001From c62a6f32ab965de2ec77a614f20f04568116835b Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Thu, 5 Sep 2019 21:39:05 -0700
4Subject: [PATCH 2/2] util_sec.c: Move __thread variable to global scope
5
6Make clang happy otherwise it complains about variable scope
7
8fixes
9
10source3/./lib/util_sec.c:470:4: error: '__thread' variables must have global storage
11 } __thread cache;
12 ^
13
14Signed-off-by: Khem Raj <raj.khem@gmail.com>
15---
16 source3/lib/util_sec.c | 19 +++++++++++--------
17 1 file changed, 11 insertions(+), 8 deletions(-)
18
19diff --git a/source3/lib/util_sec.c b/source3/lib/util_sec.c
20index 9408269..7390318 100644
21--- a/source3/lib/util_sec.c
22+++ b/source3/lib/util_sec.c
23@@ -444,6 +444,17 @@ void become_user_permanently(uid_t uid, gid_t gid)
24 assert_gid(gid, gid);
25 }
26
27+#ifdef HAVE___THREAD
28+ struct cache_t {
29+ bool active;
30+ uid_t uid;
31+ gid_t gid;
32+ size_t setlen;
33+ uintptr_t gidset;
34+ };
35+
36+static __thread struct cache_t cache;
37+#endif
38 /**********************************************************
39 Function to set thread specific credentials. Leave
40 saved-set uid/gid alone.Must be thread-safe code.
41@@ -461,14 +472,6 @@ int set_thread_credentials(uid_t uid,
42 * available.
43 */
44 #ifdef HAVE___THREAD
45- static struct {
46- bool active;
47- uid_t uid;
48- gid_t gid;
49- size_t setlen;
50- uintptr_t gidset;
51- } __thread cache;
52-
53 if (cache.active &&
54 cache.uid == uid &&
55 cache.gid == gid &&
56--
572.23.0
58