]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
libsmb: Reduce indentation in SMBC_find_server()
authorVolker Lendecke <vl@samba.org>
Mon, 5 May 2025 13:55:13 +0000 (15:55 +0200)
committerVolker Lendecke <vl@samba.org>
Thu, 15 May 2025 14:03:34 +0000 (14:03 +0000)
Use an early return

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
source3/libsmb/libsmb_server.c

index 6454e58519c4c264658b7b11e6c3be4879bc3fdd..f4a6a41c1cb32831e0b02abb005fb3028a012840 100644 (file)
@@ -243,36 +243,35 @@ check_server_cache:
 
        }
 
-       if (srv) {
-               if (smbc_getFunctionCheckServer(context)(context, srv)) {
-                       /*
-                         * This server is no good anymore
-                         * Try to remove it and check for more possible
-                         * servers in the cache
-                         */
-                       if (smbc_getFunctionRemoveUnusedServer(context)(context,
-                                                                        srv)) {
-                                /*
-                                 * We could not remove the server completely,
-                                 * remove it from the cache so we will not get
-                                 * it again. It will be removed when the last
-                                 * file/dir is closed.
-                                 */
-                               smbc_getFunctionRemoveCachedServer(context)(context,
-                                                                            srv);
-                       }
+       if (srv == NULL) {
+               return NULL;
+       }
 
+       if (smbc_getFunctionCheckServer(context)(context, srv)) {
+               /*
+                * This server is no good anymore
+                * Try to remove it and check for more possible
+                * servers in the cache
+                */
+               if (smbc_getFunctionRemoveUnusedServer(context)(context, srv)) {
                        /*
-                         * Maybe there are more cached connections to this
-                         * server
-                         */
-                       goto check_server_cache;
+                        * We could not remove the server completely,
+                        * remove it from the cache so we will not get
+                        * it again. It will be removed when the last
+                        * file/dir is closed.
+                        */
+                       smbc_getFunctionRemoveCachedServer(context)(context,
+                                                                   srv);
                }
 
-               return srv;
-       }
+               /*
+                * Maybe there are more cached connections to this
+                * server
+                */
+               goto check_server_cache;
+       }
 
-        return NULL;
+       return srv;
 }
 
 static struct cli_credentials *SMBC_auth_credentials(TALLOC_CTX *mem_ctx,