From: Volker Lendecke Date: Fri, 14 Sep 2018 14:03:57 +0000 (+0200) Subject: smbd: Slightly simplify downgrade_lease() X-Git-Tag: tdb-1.3.17~1464 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=664808af09bf42206af2ce15c9e9b5d773ab56ca;p=thirdparty%2Fsamba.git smbd: Slightly simplify downgrade_lease() 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 Reviewed-by: Stefan Metzmacher --- diff --git a/source3/smbd/oplock.c b/source3/smbd/oplock.c index fdb87314d72..ded47b2f525 100644 --- a/source3/smbd/oplock.c +++ b/source3/smbd/oplock.c @@ -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