smbd: Slightly simplify downgrade_lease()
authorVolker Lendecke <vl@samba.org>
Fri, 14 Sep 2018 14:03:57 +0000 (16:03 +0200)
committerStefan Metzmacher <metze@samba.org>
Tue, 2 Oct 2018 16:13:20 +0000 (18:13 +0200)
As much as I dislike }else{ and prefer early returns, I even more
dislike asking for the same condition in two different ways.

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

index fdb87314d7253baa73ad9c38eded9c3cf8742978..ded47b2f525745de5898cb327508f0576e10f81d 100644 (file)
@@ -639,9 +639,6 @@ NTSTATUS downgrade_lease(struct smbXsrv_connection *xconn,
                }
 
                state->xconn = xconn;
-               if (l->current_state & (~SMB2_LEASE_READ)) {
-                       state->break_flags = SMB2_NOTIFY_BREAK_LEASE_FLAG_ACK_REQUIRED;
-               }
                state->lease_key = l->lease_key;
                state->break_from = l->current_state;
                state->break_to = l->breaking_to_requested;
@@ -649,7 +646,10 @@ NTSTATUS downgrade_lease(struct smbXsrv_connection *xconn,
                        state->new_epoch = l->epoch;
                }
 
-               if (state->break_flags == 0) {
+               if (l->current_state & (~SMB2_LEASE_READ)) {
+                       state->break_flags =
+                               SMB2_NOTIFY_BREAK_LEASE_FLAG_ACK_REQUIRED;
+               } else {
                        /*
                         * This is an async break without
                         * SMB2_NOTIFY_BREAK_LEASE_FLAG_ACK_REQUIRED