]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
util_sec.c: Move __thread variable to global scope
authorKhem Raj <raj.khem@gmail.com>
Fri, 6 Sep 2019 04:39:05 +0000 (21:39 -0700)
committerAndreas Schneider <asn@cryptomilk.org>
Tue, 17 Sep 2019 12:31:40 +0000 (12:31 +0000)
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 <raj.khem@gmail.com>
Reviewed-by: Matthias Dieter Wallnöfer <mdw@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
source3/lib/util_sec.c

index 974e458b06ed5d705bff6d7bc91bba0d7f08cfd8..b6fb6c0a4a18e50d40503b3d867aca2ecc0475ca 100644 (file)
@@ -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 &&