From 7dce1d3eebdc3e2e61a40decb975dc3de361a306 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Tue, 11 Jun 2019 05:04:39 -0700 Subject: [PATCH] smbd: Slightly simplify smb_set_posix_lock() Avoid indentation by an early return; Best viewed with git show -b Signed-off-by: Volker Lendecke Reviewed-by: Stefan Metzmacher --- source3/smbd/trans2.c | 69 ++++++++++++++++++++++++++------------------------- 1 file changed, 35 insertions(+), 34 deletions(-) diff --git a/source3/smbd/trans2.c b/source3/smbd/trans2.c index 1fbf3ff9c47..26f96f564eb 100644 --- a/source3/smbd/trans2.c +++ b/source3/smbd/trans2.c @@ -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; } -- 2.11.4.GIT