From: Volker Lendecke Date: Thu, 26 Jul 2018 13:46:18 +0000 (+0200) Subject: smbd: Simplify logic in fsp_lease_update X-Git-Tag: tdb-1.3.17~1685 X-Git-Url: http://git.samba.org/?p=samba.git;a=commitdiff_plain;h=9108572039e42fbc0ec540d8a89764d81597dd5d smbd: Simplify logic in fsp_lease_update One if-condition is better than two Signed-off-by: Volker Lendecke Reviewed-by: Ralph Boehme --- diff --git a/source3/smbd/oplock.c b/source3/smbd/oplock.c index a23b87769e2..8073fbe3dca 100644 --- a/source3/smbd/oplock.c +++ b/source3/smbd/oplock.c @@ -400,11 +400,7 @@ bool fsp_lease_update(struct share_mode_lock *lck, struct share_mode_lease *l = NULL; idx = find_share_mode_lease(d, client_guid, &lease->lease.lease_key); - if (idx != -1) { - l = &d->leases[idx]; - } - - if (l == NULL) { + if (idx == -1) { DEBUG(1, ("%s: Could not find lease entry\n", __func__)); TALLOC_FREE(lease->timeout); lease->lease.lease_state = SMB2_LEASE_NONE; @@ -413,6 +409,8 @@ bool fsp_lease_update(struct share_mode_lock *lck, return false; } + l = &d->leases[idx]; + DEBUG(10,("%s: refresh lease state\n", __func__)); /* Ensure we're in sync with current lease state. */