]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
smbd: Simplify logic in smb2_lease_break_send
authorVolker Lendecke <vl@samba.org>
Thu, 26 Jul 2018 12:52:55 +0000 (14:52 +0200)
committerAndreas Schneider <asn@cryptomilk.org>
Fri, 7 Sep 2018 15:26:18 +0000 (17:26 +0200)
If/else if chains are hard to follow to me. Simplify the code by using
early returns.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
source3/smbd/smb2_break.c

index 21fbef42dcedcd448ebfcb61b46c1d36ea492d51..ec9c0f1376b7c0e77f95ad5a14f019112487f40c 100644 (file)
@@ -386,14 +386,16 @@ static struct tevent_req *smbd_smb2_lease_break_send(
                        status = NT_STATUS_OBJECT_NAME_NOT_FOUND;
                        DEBUG(10, ("No record for lease key found\n"));
                }
-       } else if (!NT_STATUS_IS_OK(lls.status)) {
-               status = lls.status;
-       } else if (lls.num_file_ids == 0) {
-               status = NT_STATUS_OBJECT_NAME_NOT_FOUND;
+               tevent_req_nterror(req, status);
+               return tevent_req_post(req, ev);
        }
 
-       if (!NT_STATUS_IS_OK(status)) {
-               tevent_req_nterror(req, status);
+       if (tevent_req_nterror(req, lls.status)) {
+               return tevent_req_post(req, ev);
+       }
+
+       if (lls.num_file_ids == 0) {
+               tevent_req_nterror(req, NT_STATUS_OBJECT_NAME_NOT_FOUND);
                return tevent_req_post(req, ev);
        }