]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
lib: Reduce indentation with an early return
authorVolker Lendecke <vl@samba.org>
Fri, 9 Jan 2026 09:45:40 +0000 (10:45 +0100)
committerVolker Lendecke <vl@samba.org>
Tue, 20 Jan 2026 11:53:34 +0000 (11:53 +0000)
Review with "git show -w"

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
source3/lib/util_sec.c

index 8fe0efa0bf4f0f893032a337d8ae73d4f6298a3e..73d1314b17ee80aa812581135ac952644d2f8cd0 100644 (file)
@@ -60,27 +60,28 @@ as non-root while catching trapdoor systems
 
 void sec_init(void)
 {
-       static int initialized;
+       static bool initialized = false;
 
-       if (!initialized) {
+       if (initialized) {
+               return;
+       }
 
 #ifndef AUTOCONF_TEST
-               if (uid_wrapper_enabled()) {
-                       setenv("UID_WRAPPER_MYUID", "1", 1);
-               }
+       if (uid_wrapper_enabled()) {
+               setenv("UID_WRAPPER_MYUID", "1", 1);
+       }
 #endif
 
-               initial_uid = geteuid();
-               initial_gid = getegid();
+       initial_uid = geteuid();
+       initial_gid = getegid();
 
 #ifndef AUTOCONF_TEST
-               if (uid_wrapper_enabled()) {
-                       unsetenv("UID_WRAPPER_MYUID");
-               }
+       if (uid_wrapper_enabled()) {
+               unsetenv("UID_WRAPPER_MYUID");
+       }
 #endif
 
-               initialized = 1;
-       }
+       initialized = true;
 }
 
 /****************************************************************************