]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
smbd: Slightly simplify smb_set_posix_lock()
authorVolker Lendecke <vl@samba.org>
Tue, 11 Jun 2019 12:04:39 +0000 (05:04 -0700)
committerJeremy Allison <jra@samba.org>
Tue, 18 Jun 2019 12:54:01 +0000 (12:54 +0000)
Avoid indentation by an early return;

Best viewed with git show -b

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

index 1fbf3ff9c47eaa5259301d8af0855bb08a6fba45..26f96f564eb8e2ba7a1e8b854001c69b11ce4dce 100644 (file)
@@ -7277,6 +7277,8 @@ static NTSTATUS smb_set_posix_lock(connection_struct *conn,
        uint64_t smblctx;
        bool blocking_lock = False;
        enum brl_type lock_type;
+       uint64_t block_smblctx;
+       struct byte_range_lock *br_lck;
 
        NTSTATUS status = NT_STATUS_OK;
 
@@ -7339,43 +7341,42 @@ static NTSTATUS smb_set_posix_lock(connection_struct *conn,
                                count,
                                offset,
                                POSIX_LOCK);
-       } else {
-               uint64_t block_smblctx;
+               return status;
+       }
 
-               struct byte_range_lock *br_lck = do_lock(req->sconn->msg_ctx,
-                                                       fsp,
-                                                       smblctx,
-                                                       count,
-                                                       offset,
-                                                       lock_type,
-                                                       POSIX_LOCK,
-                                                       blocking_lock,
-                                                       &status,
-                                                       &block_smblctx);
-
-               if (br_lck && blocking_lock && ERROR_WAS_LOCK_DENIED(status)) {
-                       /*
-                        * A blocking lock was requested. Package up
-                        * this smb into a queued request and push it
-                        * onto the blocking lock queue.
-                        */
-                       if(push_blocking_lock_request(br_lck,
-                                               req,
-                                               fsp,
-                                               -1, /* infinite timeout. */
-                                               0,
-                                               smblctx,
-                                               lock_type,
-                                               POSIX_LOCK,
-                                               offset,
-                                               count,
-                                               block_smblctx)) {
-                               TALLOC_FREE(br_lck);
-                               return status;
-                       }
+       br_lck = do_lock(req->sconn->msg_ctx,
+                        fsp,
+                        smblctx,
+                        count,
+                        offset,
+                        lock_type,
+                        POSIX_LOCK,
+                        blocking_lock,
+                        &status,
+                        &block_smblctx);
+
+       if (br_lck && blocking_lock && ERROR_WAS_LOCK_DENIED(status)) {
+               /*
+                * A blocking lock was requested. Package up this smb
+                * into a queued request and push it onto the blocking
+                * lock queue.
+                */
+               if(push_blocking_lock_request(br_lck,
+                                             req,
+                                             fsp,
+                                             -1, /* infinite timeout. */
+                                             0,
+                                             smblctx,
+                                             lock_type,
+                                             POSIX_LOCK,
+                                             offset,
+                                             count,
+                                             block_smblctx)) {
+                       TALLOC_FREE(br_lck);
+                       return status;
                }
-               TALLOC_FREE(br_lck);
        }
+       TALLOC_FREE(br_lck);
 
        return status;
 }