Brad Bishop | c1d3433 | 2019-09-09 14:56:00 -0400 | [diff] [blame^] | 1 | From c62a6f32ab965de2ec77a614f20f04568116835b Mon Sep 17 00:00:00 2001 |
| 2 | From: Khem Raj <raj.khem@gmail.com> |
| 3 | Date: Thu, 5 Sep 2019 21:39:05 -0700 |
| 4 | Subject: [PATCH 2/2] util_sec.c: Move __thread variable to global scope |
| 5 | |
| 6 | Make clang happy otherwise it complains about variable scope |
| 7 | |
| 8 | fixes |
| 9 | |
| 10 | source3/./lib/util_sec.c:470:4: error: '__thread' variables must have global storage |
| 11 | } __thread cache; |
| 12 | ^ |
| 13 | |
| 14 | Signed-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 | |
| 19 | diff --git a/source3/lib/util_sec.c b/source3/lib/util_sec.c |
| 20 | index 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 | -- |
| 57 | 2.23.0 |
| 58 | |